Skip to content
  1. Oct 04, 2012
  2. Oct 03, 2012
    • Preston Gurd's avatar
      This Patch corrects a problem whereby the optimization to use a faster divide · 5509e3d7
      Preston Gurd authored
      instruction (for Intel Atom) was not being done by Clang, because
      the type context used by Clang is not the default context.
      
      It fixes the problem by getting the global context types for each div/rem
      instruction in order to compare them against the types in the BypassTypeMap.
      
      Tests for this will be done as a separate patch to Clang.
      
      Patch by Tyler Nowicki.
      
      llvm-svn: 165126
      5509e3d7
    • Dmitry Vyukov's avatar
      f4cb2212
    • Chandler Carruth's avatar
      Fix an issue where we failed to adjust the alignment constraint on · 08e5f49f
      Chandler Carruth authored
      a memcpy to reflect that '0' has a different meaning when applied to
      a load or store. Now we correctly use underaligned loads and stores for
      the test case added.
      
      llvm-svn: 165101
      08e5f49f
    • Chandler Carruth's avatar
      Try to use a better set of abstractions for computing the alignment · 4b2b38d3
      Chandler Carruth authored
      necessary during rewriting. As part of this, fix a real think-o here
      where we might have left off an alignment specification when the address
      is in fact underaligned. I haven't come up with any way to trigger this,
      as there is always some other factor that reduces the alignment, but it
      certainly might have been an observable bug in some way I can't think
      of. This also slightly changes the strategy for placing explicit
      alignments on loads and stores to only do so when the alignment does not
      match that required by the ABI. This causes a few redundant alignments
      to go away from test cases.
      
      I've also added a couple of tests that really push on the alignment that
      we end up with on loads and stores. More to come here as I try to fix an
      underlying bug I have conjectured and produced test cases for, although
      it's not clear if this bug is the one currently hitting dragonegg's
      gcc47 bootstrap.
      
      llvm-svn: 165100
      4b2b38d3
    • Chandler Carruth's avatar
      Switch the SetVector::remove_if implementation to use partition which · 3f57b829
      Chandler Carruth authored
      preserves the values of the relocated entries, unlikely remove_if. This
      allows walking them and erasing them.
      
      Also flesh out the predicate we are using for this to support the
      various constraints actually imposed on a UnaryPredicate -- without this
      we can't compose it with std::not1.
      
      Thanks to Sean Silva for the review here and noticing the issue with
      std::remove_if.
      
      llvm-svn: 165073
      3f57b829
    • Chandler Carruth's avatar
      Teach the new SROA to handle cases where an alloca that has already been · b09f0a3c
      Chandler Carruth authored
      scheduled for processing on the worklist eventually gets deleted while
      we are processing another alloca, fixing the original test case in
      PR13990.
      
      To facilitate this, add a remove_if helper to the SetVector abstraction.
      It's not easy to use the standard abstractions for this because of the
      specifics of SetVectors types and implementation.
      
      Finally, a nice small test case is included. Thanks to Benjamin for the
      fantastic reduced test case here! All I had to do was delete some empty
      basic blocks!
      
      llvm-svn: 165065
      b09f0a3c
  3. Oct 02, 2012
    • Chandler Carruth's avatar
      Fix another crasher in SROA, reported by Joel. · 6c3890b6
      Chandler Carruth authored
      We require that the indices into the use lists are stable in order to
      build fast lookup tables to locate a particular partition use from an
      operand of a PHI or select. This is (obviously in hind sight)
      incompatible with erasing elements from the array. Really, we don't want
      to erase anyways. It is expensive, and a rare operation. Instead, simply
      weaken the contract of the PartitionUse structure to allow null Use
      pointers to represent dead uses. Now we can clear out the pointer to
      mark things as dead, and all it requires is adding some 'continue'
      checks to the various loops.
      
      I'm still reducing a test case for this, as the test case I have is
      huge. I think this one I can get a nice test case for though, as it was
      much more deterministic.
      
      llvm-svn: 165032
      6c3890b6
    • Chandler Carruth's avatar
      Fix a silly coding error on my part. The whole point of the speculator · 3903e052
      Chandler Carruth authored
      being separate was that it can grow the use list. As a consequence, we
      can't use the iterator-pair interface, we need an index based interface.
      Expose such an interface from the AllocaPartitioning, and use it in the
      speculator.
      
      This should at least fix a use-after-free bug found by Duncan, and may
      fix some of the other crashers.
      
      I don't have a nice deterministic test case yet, but if I get a good
      one, I'll add it.
      
      llvm-svn: 165027
      3903e052
    • Chandler Carruth's avatar
      Turn the new SROA pass back on. Let's see if it sticks this time. =] · 4e435993
      Chandler Carruth authored
      Again, let me know if anything breaks due to this!
      
      llvm-svn: 164986
      4e435993
  4. Oct 01, 2012
    • Chandler Carruth's avatar
      Make this plural. Spotted by Duncan in review (and a very old typo, this · d71ef3a0
      Chandler Carruth authored
      is the second time I've moved this comment around...)
      
      llvm-svn: 164939
      d71ef3a0
    • Chandler Carruth's avatar
      Prune some unnecessary includes. · d325f802
      Chandler Carruth authored
      llvm-svn: 164938
      d325f802
    • Chandler Carruth's avatar
      Fix several issues with alignment. We weren't always accounting for type · 176ca71a
      Chandler Carruth authored
      alignment requirements of the new alloca. As one consequence which was
      reported as a bug by Duncan, we overaligned memcpy calls to ranges of
      allocas after they were rewritten to types with lower alignment
      requirements. Other consquences are possible, but I don't have any test
      cases for them.
      
      llvm-svn: 164937
      176ca71a
    • Benjamin Kramer's avatar
      SimplifyCFG: Don't crash when forming a switch bitmap with an undef default value. · 9fc3dc77
      Benjamin Kramer authored
      Fixes PR13985.
      
      llvm-svn: 164934
      9fc3dc77
    • Chandler Carruth's avatar
      Factor the PHI and select speculation into a separate rewriter. This · 82a57543
      Chandler Carruth authored
      could probably be factored still further to hoist this logic into
      a generic helper, but currently I don't have particularly clean ideas
      about how to handle that.
      
      This at least allows us to drop custom load rewriting from the
      speculation logic, which in turn allows the existing load rewriting
      logic to fire. In theory, this could enable vector promotion or other
      tricks after speculation occurs, but I've not dug into such issues. This
      is primarily just cleaning up the factoring of the code and the
      resulting logic.
      
      llvm-svn: 164933
      82a57543
    • Chandler Carruth's avatar
      Refactor the PartitionUse structure to actually use the Use* instead of · 54e8f0b4
      Chandler Carruth authored
      a pair of instructions, one for the used pointer and the second for the
      user. This simplifies the representation and also makes it more dense.
      
      This was noticed because of the miscompile in PR13926. In that case, we
      were running up against a fundamental "bad idea" in the speculation of
      PHI and select instructions: the speculation and rewriting are
      interleaved, which requires phi speculation to also perform load
      rewriting! This is bad, and causes us to miss opportunities to do (for
      example) vector rewriting only exposed after PHI speculation, etc etc.
      It also, in the old system, required us to insert *new* load uses into
      the current partition's use list, which would then be ignored during
      rewriting because we had already extracted an end iterator for the use
      list. The appending behavior (and much of the other oddities) stem from
      the strange de-duplication strategy in the PartitionUse builder.
      Amusingly, all this went without notice for so long because it could
      only be triggered by having *different* GEPs into the same partition of
      the same alloca, where both different GEPs were operands of a single
      PHI, and where the GEP which was not encountered first also had multiple
      uses within that same PHI node... Hence the insane steps required to
      reproduce.
      
      So, step one in fixing this fundamental bad idea is to make the
      PartitionUse actually contain a Use*, and to make the builder do proper
      deduplication instead of funky de-duplication. This is enough to remove
      the appending behavior, and fix the miscompile in PR13926, but there is
      more work to be done here. Subsequent commits will lift the speculation
      into its own visitor. It'll be a useful step toward potentially
      extracting all of the speculation logic into a generic utility
      transform.
      
      The existing PHI test case for repeated operands has been made more
      extreme to catch even these issues. This test case, run through the old
      pass, will exactly reproduce the miscompile from PR13926. ;] We were so
      close here!
      
      llvm-svn: 164925
      54e8f0b4
  5. Sep 30, 2012
  6. Sep 29, 2012
    • Chandler Carruth's avatar
      Fix a somewhat surprising miscompile where code relying on an ABI · 903790ef
      Chandler Carruth authored
      alignment could lose it due to the alloca type moving down to a much
      smaller alignment guarantee.
      
      Now SROA will actively compute a proper alignment, factoring the target
      data, any explicit alignment, and the offset within the struct. This
      will in some cases lower the alignment requirements, but when we lower
      them below those of the type, we drop the alignment entirely to give
      freedom to the code generator to align it however is convenient.
      
      Thanks to Duncan for the lovely test case that pinned this down. =]
      
      llvm-svn: 164891
      903790ef
    • Evan Cheng's avatar
      Do not delete BBs if their addresses are taken. rdar://12396696 · 64a223ae
      Evan Cheng authored
      llvm-svn: 164866
      64a223ae
  7. Sep 28, 2012
  8. Sep 27, 2012
  9. Sep 26, 2012
Loading