Skip to content
  1. Nov 27, 2011
    • Chandler Carruth's avatar
      Introduce a loop block rotation optimization to the new block placement · 9ffb97e6
      Chandler Carruth authored
      pass. This is designed to achieve one of the important optimizations
      that the old code placement pass did, but more simply.
      
      This is a somewhat rough and *very* conservative version of the
      transform. We could get a lot fancier here if there are profitable cases
      to do so. In particular, this only looks for a single pattern, it
      insists that the loop backedge being rotated away is the last backedge
      in the chain, and it doesn't provide any means of doing better in-loop
      placement due to the rotation. However, it appears that it will handle
      the important loops I am finding in the LLVM test suite.
      
      llvm-svn: 145158
      9ffb97e6
    • Benjamin Kramer's avatar
      Move code into anonymous namespaces. · 7ba71be3
      Benjamin Kramer authored
      llvm-svn: 145154
      7ba71be3
  2. Nov 24, 2011
    • Chandler Carruth's avatar
      Fix a silly use-after-free issue. A much earlier version of this code · 7adee1a0
      Chandler Carruth authored
      need lots of fanciness around retaining a reference to a Chain's slot in
      the BlockToChain map, but that's all gone now. We can just go directly
      to allocating the new chain (which will update the mapping for us) and
      using it.
      
      Somewhat gross mechanically generated test case replicates the issue
      Duncan spotted when actually testing this out.
      
      llvm-svn: 145120
      7adee1a0
    • Chandler Carruth's avatar
      When adding blocks to the list of those which no longer have any CFG · d394bafd
      Chandler Carruth authored
      conflicts, we should only be adding the first block of the chain to the
      list, lest we try to merge into the middle of that chain. Most of the
      places we were doing this we already happened to be looking at the first
      block, but there is no reason to assume that, and in some cases it was
      clearly wrong.
      
      I've added a couple of tests here. One already worked, but I like having
      an explicit test for it. The other is reduced from a test case Duncan
      reduced for me and used to crash. Now it is handled correctly.
      
      llvm-svn: 145119
      d394bafd
  3. Nov 23, 2011
  4. Nov 22, 2011
    • Chandler Carruth's avatar
      Fix a devilish miscompile exposed by block placement. The · ee54feb6
      Chandler Carruth authored
      updateTerminator code didn't correctly handle EH terminators in one very
      specific case. AnalyzeBranch would find no terminator instruction, and
      so the fallback in updateTerminator is to assume fallthrough. This is
      correct, but the destination of the fallthrough was assumed to be the
      first successor.
      
      This is *almost always* true, but in certain cases the loop
      transformations will cause the landing pad to be the first successor!
      Instead of this brittle logic, actually look through the successors for
      a non-landing-pad accessor, and to assert if more than one is found.
      
      This will hopefully fix some (if not all) of the self host miscompiles
      with block placement. Thanks to Benjamin Kramer for reporting, Nick
      Lewycky for an initial stab at a reduction, and Duncan for endless
      advice on EH (which I know nothing about) as well as reviewing the
      actual fix.
      
      llvm-svn: 145062
      ee54feb6
    • Chandler Carruth's avatar
      Fix an obvious omission in the SelectionDAGBuilder where we were · e2530dc8
      Chandler Carruth authored
      dropping weights on the floor for invokes. This was impeding my writing
      further test cases for invoke when interacting with probabilities and
      block placement.
      
      No test case as there doesn't appear to be a way to test this stuff. =/
      Suggestions for a test case of course welcome. I hope to be able to add
      test cases that indirectly cover this eventually by adding probabilities
      to the exceptional edge and reordering blocks as a result.
      
      llvm-svn: 145060
      e2530dc8
    • Rafael Espindola's avatar
      If a register is both an early clobber and part of a tied use, handle the use · 2021f382
      Rafael Espindola authored
      before the clobber so that we copy the value if needed.
      
      Fixes pr11415.
      
      llvm-svn: 145056
      2021f382
  5. Nov 20, 2011
    • Chandler Carruth's avatar
      The logic for breaking the CFG in the presence of hot successors didn't · 18dfac38
      Chandler Carruth authored
      properly account for the *global* probability of the edge being taken.
      This manifested as a very large number of unconditional branches to
      blocks being merged against the CFG even though they weren't
      particularly hot within the CFG.
      
      The fix is to check whether the edge being merged is both locally hot
      relative to other successors for the source block, and globally hot
      compared to other (unmerged) predecessors of the destination block.
      
      This introduces a new crasher on GCC single-source, but it's currently
      behind a flag, and Ben has offered to work on the reduction. =]
      
      llvm-svn: 145010
      18dfac38
  6. Nov 19, 2011
    • Chandler Carruth's avatar
      Move the handling of unanalyzable branches out of the loop-driven chain · f3dc9eff
      Chandler Carruth authored
      formation phase and into the initial walk of the basic blocks. We
      essentially pre-merge all blocks where unanalyzable fallthrough exists,
      as we won't be able to update the terminators effectively after any
      reorderings. This is quite a bit more principled as there may be CFGs
      where the second half of the unanalyzable pair has some analyzable
      predecessor that gets placed first. Then it may get placed next,
      implicitly breaking the unanalyzable branch even though we never even
      looked at the part that isn't analyzable. I've included a test case that
      triggers this (thanks Benjamin yet again!), and I'm hoping to synthesize
      some more general ones as I dig into related issues.
      
      Also, to make this new scheme work we have to be able to handle branches
      into the middle of a chain, so add this check. We always fallback on the
      incoming ordering.
      
      Finally, this starts to really underscore a known limitation of the
      current implementation -- we don't consider broken predecessors when
      merging successors. This can caused major missed opportunities, and is
      something I'm planning on looking at next (modulo more bug reports).
      
      llvm-svn: 144994
      f3dc9eff
  7. Nov 18, 2011
  8. Nov 17, 2011
    • Chad Rosier's avatar
      When fast iseling a GEP, accumulate the offset rather than emitting a series of · f83ab704
      Chad Rosier authored
      ADDs.  MaxOffs is used as a threshold to limit the size of the offset. Tradeoffs
      being: (1) If we can't materialize the large constant then we'll cause fast-isel
      to bail. (2) Too large of an offset can't be directly encoded in the ADD
      resulting in a MOV+ADD.  Generally not a bad thing because otherwise we would
      have had ADD+ADD, but on Thumb this turns into a MOVS+MOVT+ADD. Working on a fix
      for that. (3) Conversely, too low of a threshold we'll miss opportunities to 
      coalesce ADDs.
      rdar://10412592
      
      llvm-svn: 144886
      f83ab704
    • Eli Friedman's avatar
      Make sure to replace the chain properly when DAGCombining a... · ff1eaa75
      Eli Friedman authored
      Make sure to replace the chain properly when DAGCombining a LOAD+EXTRACT_VECTOR_ELT into a single LOAD.  Fixes PR10747/PR11393.
      
      llvm-svn: 144863
      ff1eaa75
  9. Nov 16, 2011
  10. Nov 15, 2011
Loading