Skip to content
  1. Jan 02, 2013
  2. Jan 01, 2013
  3. Dec 31, 2012
  4. Dec 30, 2012
  5. Dec 21, 2012
  6. Dec 20, 2012
    • James Molloy's avatar
      Add a new attribute, 'noduplicate'. If a function contains a noduplicate call,... · 4f6fb953
      James Molloy authored
      Add a new attribute, 'noduplicate'. If a function contains a noduplicate call, the call cannot be duplicated - Jump threading, loop unrolling, loop unswitching, and loop rotation are inhibited if they would duplicate the call.
      
      Similarly inlining of the function is inhibited, if that would duplicate the call (in particular inlining is still allowed when there is only one callsite and the function has internal linkage).
      
      llvm-svn: 170704
      4f6fb953
  7. Dec 19, 2012
  8. Dec 18, 2012
  9. Dec 17, 2012
    • Chandler Carruth's avatar
      Fix another SROA crasher, PR14601. · e3f4119b
      Chandler Carruth authored
      This was a silly oversight, we weren't pruning allocas which were used
      by variable-length memory intrinsics from the set that could be widened
      and promoted as integers. Fix that.
      
      llvm-svn: 170353
      e3f4119b
    • Chandler Carruth's avatar
      Teach the rewriting of memcpy calls to support subvector copies. · 21eb4e96
      Chandler Carruth authored
      This also cleans up a bit of the memcpy call rewriting by sinking some
      irrelevant code further down and making the call-emitting code a bit
      more concrete.
      
      Previously, memcpy of a subvector would actually miscompile (!!!) the
      copy into a single vector element copy. I have no idea how this ever
      worked. =/ This is the memcpy half of PR14478 which we probably weren't
      noticing previously because it didn't actually assert.
      
      The rewrite relies on the newly refactored insert- and extractVector
      functions to do the heavy lifting, and those are the same as used for
      loads and stores which makes the test coverage a bit more meaningful
      here.
      
      llvm-svn: 170338
      21eb4e96
    • Evgeniy Stepanov's avatar
      Optimize tree walking in markAliveBlocks. · 95a80abe
      Evgeniy Stepanov authored
      Check whether a BB is known as reachable before adding it to the worklist.
      This way BB's with multiple predecessors are added to the list no more than
      once.
      
      llvm-svn: 170335
      95a80abe
    • Chandler Carruth's avatar
      Fix a secondary bug I introduced while fixing the first part of PR14478. · cacda256
      Chandler Carruth authored
      The first half of fixing this bug was actually in r170328, but was
      entirely coincidental. It did however get me to realize the nature of
      the bug, and adapt the test case to test more interesting behavior. In
      turn, that uncovered the rest of the bug which I've fixed here.
      
      This should fix two new asserts that showed up in the vectorize nightly
      tester.
      
      llvm-svn: 170333
      cacda256
    • Chandler Carruth's avatar
      Hoist a convertValue call to the two paths where it is needed. · 95e1fb8a
      Chandler Carruth authored
      I noticed this while looking at r170328. We only ever do a vector
      rewrite when the alloca *is* the vector type, so it's good to not paper
      over bugs here by doing a convertValue that isn't needed.
      
      llvm-svn: 170331
      95e1fb8a
    • Chandler Carruth's avatar
      Hoist the insertVector helper to be a static helper. · ce4562bd
      Chandler Carruth authored
      This will allow its use inside of memcpy rewriting as well. This routine
      is more complex than extractVector, and some of its uses are not 100%
      where I want them to be so there is still some work to do here.
      
      While this can technically change the output in some cases, it shouldn't
      be a change that matters -- IE, it can leave some dead code lying around
      that prior versions did not, etc.
      
      Yet another step in the refactorings leading up to the solution to the
      last component of PR14478.
      
      llvm-svn: 170328
      ce4562bd
    • Chandler Carruth's avatar
      Lift the extractVector helper all the way out to a static helper function. · b6bc8749
      Chandler Carruth authored
      The method helpers all implicitly act upon the alloca, and what we
      really want is a fully generic helper. Doing memcpy rewrites is more
      special than all other rewrites because we are at times rewriting
      instructions which touch pointers *other* than the alloca. As
      a consequence all of the helpers needed by memcpy rewriting of
      sub-vector copies will need to be generalized fully.
      
      Note that all of these helpers ({insert,extract}{Integer,Vector}) are
      woefully uncommented. I'm going to go back through and document them
      once I get the factoring correct.
      
      No functionality changed.
      
      llvm-svn: 170325
      b6bc8749
    • Chandler Carruth's avatar
      Factor the vector load rewriting into a more generic form. · 769445ef
      Chandler Carruth authored
      This makes it suitable for use in rewriting memcpy in the presence of
      subvector memcpy intrinsics.
      
      No functionality changed.
      
      llvm-svn: 170324
      769445ef
    • Chandler Carruth's avatar
      Fix the first part of PR14478: memset now works. · ccca504f
      Chandler Carruth authored
      PR14478 highlights a serious problem in SROA that simply wasn't being
      exercised due to a lack of vector input code mixed with C-library
      function calls. Part of SROA was written carefully to handle subvector
      accesses via memset and memcpy, but the rewriter never grew support for
      this. Fixing it required refactoring the subvector access code in other
      parts of SROA so it could be shared, and then fixing the splat formation
      logic and using subvector insertion (this patch).
      
      The PR isn't quite fixed yet, as memcpy is still broken in the same way.
      I'm starting on that series of patches now.
      
      Hopefully this will be enough to bring the bullet benchmark back to life
      with the bb-vectorizer enabled, but that may require fixing memcpy as
      well.
      
      llvm-svn: 170301
      ccca504f
    • Chandler Carruth's avatar
      Extract the logic for inserting a subvector into a vector alloca. · eae65a56
      Chandler Carruth authored
      No functionality changed. Another step of refactoring toward solving
      PR14487.
      
      llvm-svn: 170300
      eae65a56
    • Chandler Carruth's avatar
      Lift the integer splat computation into a helper function. · 514f34f9
      Chandler Carruth authored
      No functionality changed. Refactoring leading up to the fix for PR14478
      which requires some significant changes to the memset and memcpy
      rewriting.
      
      llvm-svn: 170299
      514f34f9
  10. Dec 15, 2012
  11. Dec 11, 2012
  12. Dec 10, 2012
    • Chandler Carruth's avatar
      Add a new visitor for walking the uses of a pointer value. · e41e7b79
      Chandler Carruth authored
      This visitor provides infrastructure for recursively traversing the
      use-graph of a pointer-producing instruction like an alloca or a malloc.
      It maintains a worklist of uses to visit, so it can handle very deep
      recursions. It automatically looks through instructions which simply
      translate one pointer to another (bitcasts and GEPs). It tracks the
      offset relative to the original pointer as long as that offset remains
      constant and exposes it during the visit as an APInt offset. Finally, it
      performs conservative escape analysis.
      
      However, currently it has some limitations that should be addressed
      going forward:
      1) It doesn't handle vectors of pointers.
      2) It doesn't provide a cheaper visitor when the constant offset
         tracking isn't needed.
      3) It doesn't support non-instruction pointer values.
      
      The current functionality is exactly what is required to implement the
      SROA pointer-use visitors in terms of this one, rather than in terms of
      their own ad-hoc base visitor, which was always very poorly specified.
      SROA has been converted to use this, and the code there deleted which
      this utility now provides.
      
      Technically speaking, using this new visitor allows SROA to handle a few
      more cases than it previously did. It is now more aggressive in ignoring
      chains of instructions which look like they would defeat SROA, but in
      fact do not because they never result in a read or write of memory.
      While this is "neat", it shouldn't be interesting for real programs as
      any such chains should have been removed by others passes long before we
      get to SROA. As a consequence, I've not added any tests for these
      features -- it shouldn't be part of SROA's contract to perform such
      heroics.
      
      The goal is to extend the functionality of this visitor going forward,
      and re-use it from passes like ASan that can benefit from doing
      a detailed walk of the uses of a pointer.
      
      Thanks to Ben Kramer for the code review rounds and lots of help
      reviewing and debugging this patch.
      
      llvm-svn: 169728
      e41e7b79
    • Chandler Carruth's avatar
      Fix PR14548: SROA was crashing on a mixture of i1 and i8 loads and stores. · e45f4658
      Chandler Carruth authored
      When SROA was evaluating a mixture of i1 and i8 loads and stores, in
      just a particular case, it would tickle a latent bug where we compared
      bits to bytes rather than bits to bits. As a consequence of the latent
      bug, we would allow integers through which were not byte-size multiples,
      a situation the later rewriting code was never intended to handle.
      
      In release builds this could trigger all manner of oddities, but the
      reported issue in PR14548 was forming invalid bitcast instructions.
      
      The only downside of this fix is that it makes it more clear that SROA
      in its current form is not capable of handling mixed i1 and i8 loads and
      stores. Sometimes with the previous code this would work by luck, but
      usually it would crash, so I'm not terribly worried. I'll watch the LNT
      numbers just to be sure.
      
      llvm-svn: 169719
      e45f4658
  13. Dec 09, 2012
  14. Dec 08, 2012
  15. Dec 06, 2012
  16. Dec 04, 2012
  17. Dec 03, 2012
    • Nadav Rotem's avatar
      Teach the jump threading optimization to stop scanning the basic block when... · 2349531d
      Nadav Rotem authored
      Teach the jump threading optimization to stop scanning the basic block when calculating the cost after passing the threshold.
      
      llvm-svn: 169135
      2349531d
    • Chandler Carruth's avatar
      Use the new script to sort the includes of every file under lib. · ed0881b2
      Chandler Carruth authored
      Sooooo many of these had incorrect or strange main module includes.
      I have manually inspected all of these, and fixed the main module
      include to be the nearest plausible thing I could find. If you own or
      care about any of these source files, I encourage you to take some time
      and check that these edits were sensible. I can't have broken anything
      (I strictly added headers, and reordered them, never removed), but they
      may not be the headers you'd really like to identify as containing the
      API being implemented.
      
      Many forward declarations and missing includes were added to a header
      files to allow them to parse cleanly when included first. The main
      module rule does in fact have its merits. =]
      
      llvm-svn: 169131
      ed0881b2
    • Chandler Carruth's avatar
      Remove some buggy and apparantly unnecessary code from SROA. · f02b8bf1
      Chandler Carruth authored
      The partitioning logic attempted to handle uses of an alloca with an
      offset starting before the alloca so long as the use had some overlap
      with the alloca itself. However, there was a bug where we tested
      '(uint64_t)Offset >= AllocSize' without first checking whether 'Offset'
      was positive. As a consequence, essentially every negative offset (that
      is, starting *before* the alloca does) would be thrown out, even if it
      was overlapping. The subsequent code to throw out negative offsets which
      were actually non-overlapping was essentially dead. The code to *handle*
      overlapping negative offsets was actually dead!
      
      I've just removed all of this, and taught SROA to discard any uses which
      start prior to the alloca from the beginning. It has the lovely property
      of simplifying the code. =] All the tests still pass, and in fact no new
      tests are needed as this is already covered by our testsuite. Fixing the
      code so that negative offsets work the way the comments indicate they
      were supposed to work causes regressions. That's how I found this.
      
      Anyways, this is all progress in the correct direction -- tightening up
      SROA to be maximally aggressive. Some day, I really hope to turn
      out-of-bounds accesses to an alloca into 'unreachable'.
      
      llvm-svn: 169120
      f02b8bf1
  18. Dec 01, 2012
  19. Nov 30, 2012
    • Bill Wendling's avatar
      Replace r168930 with a more reasonable patch. · c786b312
      Bill Wendling authored
      The original patch removed a bunch of code that the SjLjEHPrepare pass placed
      into the entry block if all of the landing pads were removed during the
      CodeGenPrepare class. The more natural way of doing things is to run the CGP
      *before* we run the SjLjEHPrepare pass.
      
      Make it so!
      
      llvm-svn: 169044
      c786b312
Loading