Skip to content
  1. Oct 13, 2012
    • Jakob Stoklund Olesen's avatar
      Allow for loops in LiveIntervals::pruneValue(). · 2f6dfc7d
      Jakob Stoklund Olesen authored
      It is possible that the live range of the value being pruned loops back
      into the kill MBB where the search started. When that happens, make sure
      that the beginning of KillMBB is also pruned.
      
      Instead of starting a DFS at KillMBB and skipping the root of the
      search, start a DFS at each KillMBB successor, and allow the search to
      loop back to KillMBB.
      
      This fixes PR14078.
      
      llvm-svn: 165872
      2f6dfc7d
    • Benjamin Kramer's avatar
      X86: Fix accidentally swapped operands. · ecd15d7f
      Benjamin Kramer authored
      llvm-svn: 165871
      ecd15d7f
    • Chandler Carruth's avatar
      Teach SROA to cope with wrapper aggregates. These show up a lot in ABI · ba931992
      Chandler Carruth authored
      type coercion code, especially when targetting ARM. Things like [1
      x i32] instead of i32 are very common there.
      
      The goal of this logic is to ensure that when we are picking an alloca
      type, we look through such wrapper aggregates and across any zero-length
      aggregate elements to find the simplest type possible to form a type
      partition.
      
      This logic should (generally speaking) rarely fire. It only ends up
      kicking in when an alloca is accessed using two different types (for
      instance, i32 and float), and the underlying alloca type has wrapper
      aggregates around it. I noticed a significant amount of this occurring
      looking at stepanov_abstraction generated code for arm, and suspect it
      happens elsewhere as well.
      
      Note that this doesn't yet address truly heinous IR productions such as
      PR14059 is concerning. Those result in mismatched *sizes* of types in
      addition to mismatched access and alloca types.
      
      llvm-svn: 165870
      ba931992
    • Chandler Carruth's avatar
      Speculatively harden the conversion logic. I have no idea if this will · 482c6178
      Chandler Carruth authored
      help the dragonegg builders, and no test case at this point, but this
      was one dimly plausible case I spotted by inspection. Hopefully will get
      a testcase from those bots soon-ish, and will tidy this up with proper
      testing.
      
      llvm-svn: 165869
      482c6178
    • Benjamin Kramer's avatar
      X86: Promote i8 cmov when both operands are coming from truncates of the same width. · d6b9362f
      Benjamin Kramer authored
      X86 doesn't have i8 cmovs so isel would emit a branch. Emitting branches at this
      level is often not a good idea because it's too late for many optimizations to
      kick in. This solution doesn't add any extensions (truncs are free) and tries
      to avoid introducing partial register stalls by filtering direct copyfromregs.
      
      I'm seeing a ~10% speedup on reading a random .png file with libpng15 via
      graphicsmagick on x86_64/westmere, but YMMV depending on the microarchitecture.
      
      llvm-svn: 165868
      d6b9362f
    • Chandler Carruth's avatar
      Silence a warning in -assert builds. · 0fb8a778
      Chandler Carruth authored
      llvm-svn: 165867
      0fb8a778
    • Chandler Carruth's avatar
      Clean up how we rewrite loads and stores to the whole alloca. When these · 891fec0b
      Chandler Carruth authored
      are single value types, the load and store should be directly based upon
      the alloca and then bitcasting can fix the type as needed afterward.
      This might in theory improve some of the IR coming out of SROA, but
      I don't expect big changes yet and don't have any test cases on hand.
      This is really just a cleanup/refactoring patch. The next patch will
      cause this code path to be hit a lot more, actually get SROA to promote
      more allocas and include several more test cases.
      
      llvm-svn: 165864
      891fec0b
    • Chad Rosier's avatar
      [ms-inline asm] Remove the MatchInstruction() function. Previously, this was · 49963555
      Chad Rosier authored
      the interface between the front-end and the MC layer when parsing inline
      assembly.  Unfortunately, this is too deep into the parsing stack. Specifically,
      we're unable to handle target-independent assembly (i.e., assembly directives,
      labels, etc.).  Note the MatchAndEmitInstruction() isn't the correct
      abstraction either.  I'll be exposing target-independent hooks shortly, so this
      is really just a cleanup.
      
      llvm-svn: 165858
      49963555
    • Andrew Kaylor's avatar
      Check section type rather than assuming it's code when emitting sections while... · 4732872b
      Andrew Kaylor authored
      Check section type rather than assuming it's code when emitting sections while processing relocations.
      
      llvm-svn: 165854
      4732872b
    • Manman Ren's avatar
      ARM: tail-call inside a function where part of a byval argument is on caller's · 7e48b252
      Manman Ren authored
      local frame causes problem.
      
      For example:
      void f(StructToPass s) {
        g(&s, sizeof(s));
      }
      will cause problem with tail-call since part of s is passed via registers and
      saved in f's local frame. When g tries to access s, part of s may be corrupted
      since f's local frame is popped out before the tail-call.
      
      The current fix is to disable tail-call if getVarArgsRegSaveSize is not 0 for
      the caller. This is a conservative approach, if we can prove the address of
      s or part of s is not taken and passed to g, it should be okay to perform
      tail-call.
      
      rdar://12442472
      
      llvm-svn: 165853
      7e48b252
    • Chad Rosier's avatar
      [ms-inline asm] Capitalize per coding standard. · 4453e845
      Chad Rosier authored
      llvm-svn: 165847
      4453e845
    • Jim Grosbach's avatar
      ARM: Mark VSELECT as 'expand'. · 30af442a
      Jim Grosbach authored
      The backend already pattern matches to form VBSL when it can. We may want to
      teach it to use the vbsl intrinsics at some point to prevent machine licm from
      mucking with this, but using the Expand is completely correct.
      
      http://llvm.org/bugs/show_bug.cgi?id=13831
      http://llvm.org/bugs/show_bug.cgi?id=13961
      
      Patch by Peter Couperus <peter.couperus@st.com>.
      
      llvm-svn: 165845
      30af442a
    • Chad Rosier's avatar
      [ms-inline asm] Use the new API introduced in r165830 in lieu of the · 2f480a8a
      Chad Rosier authored
      MapAndConstraints vector.  Also remove the unused Kind argument.
      
      llvm-svn: 165833
      2f480a8a
  2. 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
  3. Oct 11, 2012
Loading