llvm-6502/lib/Transforms/Scalar
Chandler Carruth 3d69cf57e1 [LPM] Make LCSSA a utility with a FunctionPass that applies it to all
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200067 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-25 04:07:24 +00:00
..
ADCE.cpp Use SmallVectorImpl::iterator/const_iterator instead of SmallVector to avoid specifying the vector size. 2013-07-04 01:31:24 +00:00
CMakeLists.txt Revert "Revert "Add Constant Hoisting Pass" (r200034)" 2014-01-25 02:02:55 +00:00
CodeGenPrepare.cpp Revert "Revert "Add Constant Hoisting Pass" (r200034)" 2014-01-25 02:02:55 +00:00
ConstantHoisting.cpp Revert "Revert "Add Constant Hoisting Pass" (r200034)" 2014-01-25 02:02:55 +00:00
ConstantProp.cpp Move all of the header files which are involved in modelling the LLVM IR 2013-01-02 11:36:10 +00:00
CorrelatedValuePropagation.cpp CVP: If we have a PHI with an incoming select, try to skip the select. 2013-02-24 15:34:43 +00:00
DCE.cpp Move all of the header files which are involved in modelling the LLVM IR 2013-01-02 11:36:10 +00:00
DeadStoreElimination.cpp [PM] Split DominatorTree into a concrete analysis result object which 2014-01-13 13:07:17 +00:00
EarlyCSE.cpp [PM] Split DominatorTree into a concrete analysis result object which 2014-01-13 13:07:17 +00:00
FlattenCFGPass.cpp Factor FlattenCFG out from SimplifyCFG 2013-08-06 02:43:45 +00:00
GlobalMerge.cpp Change tabs to spaces. 2013-07-22 21:11:30 +00:00
GVN.cpp [PM] Split DominatorTree into a concrete analysis result object which 2014-01-13 13:07:17 +00:00
IndVarSimplify.cpp [PM] Split DominatorTree into a concrete analysis result object which 2014-01-13 13:07:17 +00:00
JumpThreading.cpp Don't eliminate a partially redundant load if it's in a landing pad. 2013-10-21 04:09:17 +00:00
LICM.cpp [LPM] Make LCSSA a utility with a FunctionPass that applies it to all 2014-01-25 04:07:24 +00:00
LLVMBuild.txt Add proper dependencies to LLVMBuild.txt in llvm/lib. 2013-12-10 05:39:34 +00:00
LoopDeletion.cpp [PM] Split DominatorTree into a concrete analysis result object which 2014-01-13 13:07:17 +00:00
LoopIdiomRecognize.cpp Fix known typos 2014-01-24 17:20:08 +00:00
LoopInstSimplify.cpp [PM] Split DominatorTree into a concrete analysis result object which 2014-01-13 13:07:17 +00:00
LoopRerollPass.cpp [PM] Split DominatorTree into a concrete analysis result object which 2014-01-13 13:07:17 +00:00
LoopRotation.cpp [PM] Split DominatorTree into a concrete analysis result object which 2014-01-13 13:07:17 +00:00
LoopStrengthReduce.cpp Loop strength reduce: fix function name. 2014-01-22 13:27:00 +00:00
LoopUnrollPass.cpp [LPM] Make LoopSimplify no longer a LoopPass and instead both a utility 2014-01-23 11:23:19 +00:00
LoopUnswitch.cpp [PM] Split DominatorTree into a concrete analysis result object which 2014-01-13 13:07:17 +00:00
LowerAtomic.cpp Move all of the header files which are involved in modelling the LLVM IR 2013-01-02 11:36:10 +00:00
Makefile
MemCpyOptimizer.cpp Handle an addrspacecast case in memcpyopt 2014-01-22 21:53:19 +00:00
PartiallyInlineLibCalls.cpp Turn MipsOptimizeMathLibCalls into a target-independent scalar transform 2013-08-23 10:27:02 +00:00
Reassociate.cpp Put the functionality for printing a value to a raw_ostream as an 2014-01-09 02:29:41 +00:00
Reg2Mem.cpp Move all of the header files which are involved in modelling the LLVM IR 2013-01-02 11:36:10 +00:00
SampleProfile.cpp [PM] Split DominatorTree into a concrete analysis result object which 2014-01-13 13:07:17 +00:00
Scalar.cpp Revert "Revert "Add Constant Hoisting Pass" (r200034)" 2014-01-25 02:02:55 +00:00
Scalarizer.cpp Fix Scalarizer insertion point when replacing PHIs with insertelements 2013-12-23 14:51:56 +00:00
ScalarReplAggregates.cpp [PM] Split DominatorTree into a concrete analysis result object which 2014-01-13 13:07:17 +00:00
SCCP.cpp Use SmallVectorImpl& instead of SmallVector to avoid repeating small vector size. 2013-07-14 04:42:23 +00:00
SimplifyCFGPass.cpp Reapply r188119 now that the bug it exposed is fixed. 2013-08-12 22:38:43 +00:00
Sink.cpp [PM] Split DominatorTree into a concrete analysis result object which 2014-01-13 13:07:17 +00:00
SROA.cpp [SROA] Fix a bug which could cause the common type finding to return 2014-01-21 23:16:05 +00:00
StructurizeCFG.cpp [PM] Split DominatorTree into a concrete analysis result object which 2014-01-13 13:07:17 +00:00
TailRecursionElimination.cpp TRE: Move class into anonymous namespace. 2013-07-24 16:12:08 +00:00