Skip to content
  1. Oct 12, 2012
    • Jakob Stoklund Olesen's avatar
      Use a transposed algorithm for handleMove(). · 1a87a29d
      Jakob Stoklund Olesen authored
      Completely update one interval at a time instead of collecting live
      range fragments to be updated. This avoids building data structures,
      except for a single SmallPtrSet of updated intervals.
      
      Also share code between handleMove() and handleMoveIntoBundle().
      
      Add support for moving dead defs across other live values in the
      interval. The MI scheduler can do that.
      
      llvm-svn: 165824
      1a87a29d
    • Jakob Stoklund Olesen's avatar
      Fix coalescing with IMPLICIT_DEF values. · 1a3eb878
      Jakob Stoklund Olesen authored
      PHIElimination inserts IMPLICIT_DEF instructions to guarantee that all
      PHI predecessors have a live-out value. These IMPLICIT_DEF values are
      not considered to be real interference when coalescing virtual
      registers:
      
        %vreg1 = IMPLICIT_DEF
        %vreg2 = MOV32r0
      
      When joining %vreg1 and %vreg2, the IMPLICIT_DEF instruction and its
      value number should simply be erased since the %vreg2 value number now
      provides a live-out value for the PHI predecesor block.
      
      llvm-svn: 165813
      1a3eb878
    • Ulrich Weigand's avatar
      Fix big-endian codegen bug in DAGTypeLegalizer::ExpandRes_BITCAST · 9aa51d1a
      Ulrich Weigand authored
      On PowerPC, a bitcast of <16 x i8> to i128 may run through a code
      path in ExpandRes_BITCAST that attempts to do an intermediate
      bitcast to a <4 x i32> vector, and then construct the Hi and Lo parts
      of the resulting i128 by pairing up two of those i32 vector elements
      each.  The code already recognizes that on a big-endian system, the
      first two vector elements form the Hi part, and the final two vector
      elements form the Lo part (vice-versa from the little-endian situation).
      
      However, we also need to take endianness into account when forming each
      of those separate pairs:  on a big-endian system, vector element 0 is
      the *high* part of the pair making up the Hi part of the result, and
      vector element 1 is the low part of the pair.  The code currently always
      uses vector element 0 as the low part and vector element 1 as the high
      part, as is appropriate for little-endian platforms only.
      
      This patch fixes this by swapping the vector elements as they are
      paired up as appropriate.
      
      llvm-svn: 165802
      9aa51d1a
    • Duncan Sands's avatar
      Add powerpc-ibm-aix to Triple. Patch by Kai. · d5772de0
      Duncan Sands authored
      llvm-svn: 165792
      d5772de0
    • Eric Christopher's avatar
      Indenting. · ca2ff70e
      Eric Christopher authored
      llvm-svn: 165785
      ca2ff70e
    • Sebastian Pop's avatar
      fix warning · e9623261
      Sebastian Pop authored
      DependenceAnalysis.cpp:1164:32: warning: implicit truncation from 'int' to bitfield changes value from -5 to 3
            [-Wconstant-conversion]
          Result.DV[Level].Direction &= ~Dependence::DVEntry::GT;
                                     ^  ~~~~~~~~~~~~~~~~~~~~~~~~
      
      Patch from Preston Briggs <preston.briggs@gmail.com>.
      
      llvm-svn: 165784
      e9623261
    • Reed Kotler's avatar
      Div, Rem int/unsigned int · cf11c59e
      Reed Kotler authored
      llvm-svn: 165783
      cf11c59e
    • Evan Cheng's avatar
      Legalizer optimize a pair of div / mod to a call to divrem libcall if they are · 21c4adcd
      Evan Cheng authored
      not legal. However, it should use a div instruction + mul + sub if divide is
      legal. The rem legalization code was missing a check and incorrectly uses a
      divrem libcall even when div is legal.
      
      rdar://12481395
      
      llvm-svn: 165778
      21c4adcd
    • Sean Silva's avatar
      Remove unnecessary classof()'s · 506a1c5a
      Sean Silva authored
      isa<> et al. automatically infer when the cast is an upcast (including a
      self-cast), so these are no longer necessary.
      
      llvm-svn: 165767
      506a1c5a
    • Sean Silva's avatar
      Remove buggy classof(). · bead14e9
      Sean Silva authored
      This classof() is effectively saying that a MachineCodeEmitter "is-a"
      JITEmitter, but JITEmitter is in fact a descendant of
      MachineCodeEmitter, so this is not semantically correct. Consequently,
      none of the assertions that rely on these classof() actualy check
      anything.
      
      Remove the RTTI (which didn't actually check anything) and use
      static_cast<> instead.
      
      Post-Mortem Bug Analysis
      ========================
      
      Cause of the bug
      ----------------
      
      r55022 appears to be the source of the classof() and assertions removed
      by this commit. It aimed at removing some dynamic_cast<> that were
      solely in the assertions. A typical diff hunk from that commit looked
      like:
      
        -  assert(dynamic_cast<JITEmitter*>(MCE) && "Unexpected MCE?");
        -  JITEmitter *JE = static_cast<JITEmitter*>(getCodeEmitter());
        +  assert(isa<JITEmitter>(MCE) && "Unexpected MCE?");
        +  JITEmitter *JE = cast<JITEmitter>(getCodeEmitter());
      
      Hence, the source of the bug then seems to be an attempt to replace
      dynamic_cast<> with LLVM-style RTTI without properly setting up the
      class hierarchy for LLVM-style RTTI. The bug therefore appears to be
      simply a "thinko".
      
      What initially indicated the presence of the bug
      ------------------------------------------------
      
      After implementing automatic upcasting for isa<>, classof() functions of
      the form
      
        static bool classof(const Foo *) { return true; }
      
      were removed, since they only serve the purpose of optimizing
      statically-OK upcasts. A subsequent recompilation triggered a build
      failure on the isa<> tests within the removed asserts, since the
      automatic upcasting (correctly) failed to substitute this classof().
      
      Key to pinning down the root cause of the bug
      ---------------------------------------------
      
      After being alerted to the presence of the bug, some thought about the
      semantics which were being asserted by the buggy classof() revealed that
      it was incorrect.
      
      How the bug could have been prevented
      -------------------------------------
      
      This bug could have been prevented by better documentation for how to
      set up LLVM-style RTTI. This should be solved by the recently added
      documentation HowToSetUpLLVMStyleRTTI. However, this bug suggests that
      the documentation should clearly explain the contract that classof()
      must fulfill. The HowToSetUpLLVMStyleRTTI already explains this
      contract, but it is a little tucked away. A future patch will expand
      that explanation and make it more prominent.
      
      There does not appear to be a simple way to have the compiler prevent
      this bug, since fundamentally it boiled down to a spurious classof()
      where the programmer made an erroneous statement about the conversion.
      This suggests that perhaps the interface to LLVM-style RTTI of classof()
      is not the best. There is already some evidence for this, since in a
      number of places Clang has classof() forward to classofKind(Kind K)
      which evaluates the cast in terms of just the Kind. This could probably
      be generalized to simply a `static const Kind MyKind;` field in leaf
      classes and `static const Kind firstMyKind, lastMyKind;` for non-leaf
      classes, and have the rest of the work be done inside Casting.h,
      assuming that the Kind enum is laid out in a preorder traversal of the
      inheritance tree.
      
      llvm-svn: 165764
      bead14e9
    • Manman Ren's avatar
      PGO: create metadata for switch only if it has more than one targets. · 97c18762
      Manman Ren authored
      When all cases of a switch statement are dead, the weights vector only has one
      element, and we will get an ssertion failure when calling createBranchWeights.
      
      llvm-svn: 165759
      97c18762
  2. Oct 11, 2012
  3. Oct 10, 2012
    • Nadav Rotem's avatar
      Patch by Shuxin Yang <shuxin.llvm@gmail.com>. · 17418964
      Nadav Rotem authored
      Original message:
      
      The attached is the fix to radar://11663049. The optimization can be outlined by following rules:
      
         (select (x != c), e, c) -> select (x != c), e, x),
         (select (x == c), c, e) -> select (x == c), x, e)
      where the <c> is an integer constant.
      
       The reason for this change is that : on x86, conditional-move-from-constant needs two instructions;
      however, conditional-move-from-register need only one instruction.
      
        While the LowerSELECT() sounds to be the most convenient place for this optimization, it turns out to be a bad place. The reason is that by replacing the constant <c> with a symbolic value, it obscure some instruction-combining opportunities which would otherwise be very easy to spot. For that reason, I have to postpone the change to last instruction-combining phase.
      
        The change passes the test of "make check-all -C <build-root/test" and "make -C project/test-suite/SingleSource".
      
      llvm-svn: 165661
      17418964
    • Bill Schmidt's avatar
      When generating spill and reload code for vector registers on PowerPC, · b9bc4740
      Bill Schmidt authored
      the compiler makes use of GPR0.  However, there are two flavors of
      GPR0 defined by the target:  the 32-bit GPR0 (R0) and the 64-bit GPR0
      (X0).  The spill/reload code makes use of R0 regardless of whether we
      are generating 32- or 64-bit code.
      
      This patch corrects the problem in the obvious manner, using X0 and
      ADDI8 for 64-bit and R0 and ADDI for 32-bit.
      
      llvm-svn: 165658
      b9bc4740
    • Bill Schmidt's avatar
      The PowerPC VRSAVE register has been somewhat of an odd beast since · 38d94587
      Bill Schmidt authored
      the Altivec extensions were introduced.  Its use is optional, and
      allows the compiler to communicate to the operating system which
      vector registers should be saved and restored during a context switch.
      In practice, this information is ignored by the various operating
      systems using the SVR4 ABI; the kernel saves and restores the entire
      register state.  Setting the VRSAVE register is no longer performed by
      the AIX XL compilers, the IBM i compilers, or by GCC on Power Linux
      systems.  It seems best to avoid this logic within LLVM as well.
      
      This patch avoids generating code to update and restore VRSAVE for the
      PowerPC SVR4 ABIs (32- and 64-bit).  The code remains in place for the
      Darwin ABI.
      
      llvm-svn: 165656
      38d94587
    • Micah Villmow's avatar
      Add in support for expansion of all of the comparison operations to the... · 0242b9b5
      Micah Villmow authored
      Add in support for expansion of all of the comparison operations to the absolute minimum required set. This allows a backend to expand any arbitrary set of comparisons as long as a minimum set is supported.
      The minimum set of required instructions is ISD::AND, ISD::OR, ISD::SETO(or ISD::SETOEQ) and ISD::SETUO(or ISD::SETUNE). Everything is expanded into one of two patterns:
      Pattern 1: (LHS CC1 RHS) Opc (LHS CC2 RHS)
      Pattern 2: (LHS CC1 LHS) Opc (RHS CC2 RHS)
      
      llvm-svn: 165655
      0242b9b5
    • Sean Silva's avatar
      Revert r165652: "Remove unnecessary RTTI from the build." · c399c753
      Sean Silva authored
      ... Apparently the RTTI is still necessary for some reason.
      
      llvm-svn: 165654
      c399c753
    • Sean Silva's avatar
      Remove unnecessary RTTI from the build. · 9b72524e
      Sean Silva authored
      llvm-svn: 165652
      9b72524e
    • Sean Silva's avatar
      tblgen: Compile TableGen without RTTI. · bd7d2431
      Sean Silva authored
      TableGen no longer needs RTTI!
      
      llvm-svn: 165651
      bd7d2431
    • Sean Silva's avatar
      tblgen: Use semantically correct RTTI functions. · 88eb8dd4
      Sean Silva authored
      Also, some minor cleanup.
      
      llvm-svn: 165647
      88eb8dd4
    • Sean Silva's avatar
      tblgen: Mechanically move dynamic_cast<> to dyn_cast<>. · fb509ed1
      Sean Silva authored
      Some of these dyn_cast<>'s would be better phrased as isa<> or cast<>.
      That will happen in a future patch.
      
      There are also two dyn_cast_or_null<>'s slipped in instead of
      dyn_cast<>'s, since they were causing crashes with just dyn_cast<>.
      
      llvm-svn: 165646
      fb509ed1
Loading