forked from OSchip/llvm-project
8765cf702f
the loops in a function, and teach LICM to work in the presance of LCSSA. Previously, LCSSA was a loop pass. That made passes requiring it also be loop passes and unable to depend on function analysis passes easily. It also caused outer loops to have a different "canonical" form from inner loops during analysis. Instead, we go into LCSSA form and preserve it through the loop pass manager run. Note that this has the same problem as LoopSimplify that prevents enabling its verification -- loop passes which run at the end of the loop pass manager and don't preserve these are valid, but the subsequent loop pass runs of outer loops that do preserve this pass trigger too much verification and fail because the inner loop no longer verifies. The other problem this exposed is that LICM was completely unable to handle LCSSA form. It didn't preserve it and it actually would give up on moving instructions in many cases when they were used by an LCSSA phi node. I've taught LICM to support detecting LCSSA-form PHI nodes and to hoist and sink around them. This may actually let LICM fire significantly more because we put everything into LCSSA form to rotate the loop before running LICM. =/ Now LICM should handle that fine and preserve it correctly. The down side is that LICM has to require LCSSA in order to preserve it. This is just a fact of life for LCSSA. It's entirely possible we should completely remove LCSSA from the optimizer. The test updates are essentially accomodating LCSSA phi nodes in the output of LICM, and the fact that we now completely sink every instruction in ashr-crash below the loop bodies prior to unrolling. With this change, LCSSA is computed only three times in the pass pipeline. One of them could be removed (and potentially a SCEV run and a separate LoopPassManager entirely!) if we had a LoopPass variant of InstCombine that ran InstCombine on the loop body but refused to combine away LCSSA PHI nodes. Currently, this also prevents loop unrolling from being in the same loop pass manager is rotate, LICM, and unswitch. There is one thing that I *really* don't like -- preserving LCSSA in LICM is quite expensive. We end up having to re-run LCSSA twice for some loops after LICM runs because LICM can undo LCSSA both in the current loop and the parent loop. I don't really see good solutions to this other than to completely move away from LCSSA and using tools like SSAUpdater instead. llvm-svn: 200067 |
||
---|---|---|
.. | ||
2003-02-26-LoopExitNotDominated.ll | ||
2003-02-27-NestedLoopExitBlocks.ll | ||
2003-02-27-PreheaderExitNodeUpdate.ll | ||
2003-02-27-PreheaderProblem.ll | ||
2003-02-27-StoreSinkPHIs.ll | ||
2003-02-28-PromoteDifferentType.ll | ||
2003-05-02-LoadHoist.ll | ||
2003-12-11-SinkingToPHI.ll | ||
2004-09-14-AliasAnalysisInvalidate.ll | ||
2004-11-17-UndefIndexCrash.ll | ||
2006-09-12-DeadUserOfSunkInstr.ll | ||
2007-05-22-VolatileSink.ll | ||
2007-07-30-AliasSet.ll | ||
2007-09-17-PromoteValue.ll | ||
2007-09-24-PromoteNullValue.ll | ||
2007-10-01-PromoteSafeValue.ll | ||
2008-05-20-AliasSetVAArg.ll | ||
2008-07-22-LoadGlobalConstant.ll | ||
2009-12-10-LICM-Indbr-Crash.ll | ||
2011-04-06-HoistMissedASTUpdate.ll | ||
2011-04-06-PromoteResultOfPromotion.ll | ||
2011-04-09-RAUW-AST.ll | ||
2011-07-06-Alignment.ll | ||
Preserve-LCSSA.ll | ||
atomics.ll | ||
basictest.ll | ||
crash.ll | ||
debug-value.ll | ||
hoist-invariant-load.ll | ||
hoisting.ll | ||
no-preheader-test.ll | ||
promote-order.ll | ||
scalar-promote-memmodel.ll | ||
scalar_promote.ll | ||
sinking.ll | ||
speculate.ll | ||
volatile-alias.ll |