Skip to content
  1. Sep 27, 2012
  2. Sep 26, 2012
    • Bill Wendling's avatar
      Remove the `hasFnAttr' method from Function. · 863bab68
      Bill Wendling authored
      The hasFnAttr method has been replaced by querying the Attributes explicitly. No
      intended functionality change.
      
      llvm-svn: 164725
      863bab68
    • Hans Wennborg's avatar
      Address Duncan's comments on r164684: · cd3a11f7
      Hans Wennborg authored
      - Put statistics in alphabetical order
      - Don't use getZextValue when building TableInt, just use APInts
      - Introduce Create{Z,S}ExtOrTrunc in IRBuilder.
      
      llvm-svn: 164696
      cd3a11f7
    • Hans Wennborg's avatar
      Address Duncan's comments on r164682: · f2e2c108
      Hans Wennborg authored
      - Finish assert messages with exclamation mark
      - Move overflow checking into ShouldBuildLookupTable.
      
      llvm-svn: 164692
      f2e2c108
    • Chandler Carruth's avatar
      Analogous fix to memset and memcpy rewriting. Don't have a test case · 208124f5
      Chandler Carruth authored
      contrived for these yet, as I spotted them by inspection and the test
      cases are a bit more tricky to phrase.
      
      llvm-svn: 164691
      208124f5
    • Chandler Carruth's avatar
      When rewriting the pointer operand to a load or store which has · 3e4273dd
      Chandler Carruth authored
      alignment guarantees attached, re-compute the alignment so that we
      consider offsets which impact alignment.
      
      llvm-svn: 164690
      3e4273dd
    • Chandler Carruth's avatar
      Teach all of the loads, stores, memsets and memcpys created by the · 871ba724
      Chandler Carruth authored
      rewriter in SROA to carry a proper alignment. This involves
      interrogating various sources of alignment, etc. This is a more complete
      and principled fix to PR13920 as well as related bugs pointed out by Eli
      in review and by inspection in the area.
      
      Also by inspection fix the integer and vector promotion paths to create
      aligned loads and stores. I still need to work up test cases for
      these... Sorry for the delay, they were found purely by inspection.
      
      llvm-svn: 164689
      871ba724
    • Hans Wennborg's avatar
      SimplifyCFG: Make the switch-to-lookup table transformation store the · 39583b88
      Hans Wennborg authored
      tables in bitmaps when they fit in a target-legal register.
      
      This saves some space, and it also allows for building tables that would
      otherwise be deemed too sparse.
      
      One interesting case that this hits is example 7 from
      http://blog.regehr.org/archives/320. We currently generate good code
      for this when lowering the switch to the selection DAG: we build a
      bitmask to decide whether to jump to one block or the other. My patch
      will result in the same bitmask, but it removes the need for the jump,
      as the return value can just be retrieved from the mask.
      
      llvm-svn: 164684
      39583b88
    • Hans Wennborg's avatar
      SimplifyCFG: Refactor the switch-to-lookup table transformation by · 776d7126
      Hans Wennborg authored
      breaking out the building of lookup tables into a separate class.
      
      llvm-svn: 164682
      776d7126
    • Chandler Carruth's avatar
      Revert the business end of r164636 and try again. I'll come in again. ;] · 4bd8f66e
      Chandler Carruth authored
      This should really, really fix PR13916. For real this time. The
      underlying bug is... a bit more subtle than I had imagined.
      
      The setup is a code pattern that leads to an @llvm.memcpy call with two
      equal pointers to an alloca in the source and dest. Now, not any pattern
      will do. The alloca needs to be formed just so, and both pointers should
      be wrapped in different bitcasts etc. When this precise pattern hits,
      a funny sequence of events transpires. First, we correctly detect the
      potential for overlap, and correctly optimize the memcpy. The first
      time. However, we do simplify the set of users of the alloca, and that
      causes us to run the alloca back through the SROA pass in case there are
      knock-on simplifications. At this point, a curious thing has happened.
      If we happen to have an i8 alloca, we have direct i8 pointer values. So
      we don't bother creating a cast, we rewrite the arguments to the memcpy
      to dircetly refer to the alloca.
      
      Now, in an unrelated area of the pass, we have clever logic which
      ensures that when visiting each User of a particular pointer derived
      from an alloca, we only visit that User once, and directly inspect all
      of its operands which refer to that particular pointer value. However,
      the mechanism used to detect memcpy's with the potential to overlap
      relied upon getting visited once per *Use*, not once per *User*. This is
      always true *unless* the same exact value is both source and dest. It
      turns out that almost nothing actually produces that pattern though.
      
      We can hand craft test cases that more directly test this behavior of
      course, and those are included. Also, note that there is a significant
      missed optimization here -- we prove in many cases that there is
      a non-volatile memcpy call with identical source and dest addresses. We
      shouldn't prevent splitting the alloca in that case, and in fact we
      should just remove such memcpy calls eagerly. I'll address that in
      a subsequent commit.
      
      llvm-svn: 164669
      4bd8f66e
    • Craig Topper's avatar
    • Michael Ilseman's avatar
      Expansions for u/srem, using the udiv expansion. More unit tests for udiv and u/srem. · a398d4cf
      Michael Ilseman authored
      Fixed issue with Release build.
      
      llvm-svn: 164654
      a398d4cf
    • Nick Lewycky's avatar
      Don't drop the alignment on a memcpy intrinsic when producing a store. This is · d9f79106
      Nick Lewycky authored
      only a missed optimization opportunity if the store is over-aligned, but a
      miscompile if the store's new type has a higher natural alignment than the
      memcpy did. Fixes PR13920!
      
      llvm-svn: 164641
      d9f79106
  3. Sep 25, 2012
  4. Sep 24, 2012
    • Richard Osborne's avatar
      Add missing check for presence of target data. · 2fd29bfb
      Richard Osborne authored
      This avoids a crash in visitAllocaInst when target data isn't available.
      
      llvm-svn: 164539
      2fd29bfb
    • Chandler Carruth's avatar
      Enable the new SROA pass by default. · 8232bf53
      Chandler Carruth authored
      Queue the fallout. ;]
      
      llvm-svn: 164480
      8232bf53
    • Chandler Carruth's avatar
      Address one of the original FIXMEs for the new SROA pass by implementing · 92924fd2
      Chandler Carruth authored
      integer promotion analogous to vector promotion. When there is an
      integer alloca being accessed both as its integer type and as a narrower
      integer type, promote the narrower access to "insert" and "extract" the
      smaller integer from the larger one, and make the integer alloca
      a candidate for promotion.
      
      In the new formulation, we don't care about target legal integer or use
      thresholds to control things. Instead, we only perform this promotion to
      an integer type which the frontend has already emitted a load or store
      for. This bounds the scope and prevents optimization passes from
      coalescing larger and larger entities into a single integer.
      
      llvm-svn: 164479
      92924fd2
  5. Sep 23, 2012
    • Chandler Carruth's avatar
      Switch to a signed representation for the dynamic offsets while walking · e7a1ba5e
      Chandler Carruth authored
      across the uses of the alloca. It's entirely possible for negative
      numbers to come up here, and in some rare cases simply doing the 2's
      complement arithmetic isn't the correct decision. Notably, we can't zext
      the index of the GEP. The definition of GEP is that these offsets are
      sign extended or truncated to the size of the pointer, and then wrapping
      2's complement arithmetic used.
      
      This patch fixes an issue that comes up with *no* input from the
      buildbots or bootstrap afaict. The only place where it manifested,
      disturbingly, is Clang's own regression test suite. A reduced and
      targeted collection of tests are added to cope with this. Note that I've
      tried to pin down the potential cases of overflow, but may have missed
      some cases. I've tried to add a few cases to test this, but its hard
      because LLVM has quite limited support for >64bit constructs.
      
      llvm-svn: 164475
      e7a1ba5e
  6. Sep 22, 2012
    • Chandler Carruth's avatar
      Fix a case where the new SROA pass failed to zap dead operands to · 225d4bdb
      Chandler Carruth authored
      selects with a constant condition. This resulted in the operands
      remaining live through the SROA rewriter. Most of the time, this just
      caused some dead allocas to persist and get zapped by later passes, but
      in one case found by Joerg, it caused a crash when we tried to *promote*
      the alloca despite it having this dead use. We already have the
      mechanisms in place to handle this, just wire select up to them.
      
      llvm-svn: 164427
      225d4bdb
  7. Sep 21, 2012
  8. Sep 19, 2012
Loading