llvm-6502/lib/Transforms/Utils
Chandler Carruth 8d93d41027 Re-implement the analysis of uses in mem2reg to be significantly more
robust. It now uses an InstVisitor and worklist to actually walk the
uses of the Alloca transitively and detect the pattern which we can
directly promote: loads & stores of the whole alloca and instructions we
can completely ignore.

Also, with this new implementation teach both the predicate for testing
whether we can promote and the promotion engine itself to use the same
code so we no longer have strange divergence between the two code paths.

I've added some silly test cases to demonstrate that we can handle
slightly more degenerate code patterns now. See the below for why this
is even interesting.

Performance impact: roughly 1% regression in the performance of SROA or
ScalarRepl on a large C++-ish test case where most of the allocas are
basically ready for promotion. The reason is because of silly redundant
work that I've left FIXMEs for and which I'll address in the next
commit. I wanted to separate this commit as it changes the behavior.
Once the redundant work in removing the dead uses of the alloca is
fixed, this code appears to be faster than the old version. =]

So why is this useful? Because the previous requirement for promotion
required a *specific* visit pattern of the uses of the alloca to verify:
we *had* to look for no more than 1 intervening use. The end goal is to
have SROA automatically detect when an alloca is already promotable and
directly hand it to the mem2reg machinery rather than trying to
partition and rewrite it. This is a 25% or more performance improvement
for SROA, and a significant chunk of the delta between it and
ScalarRepl. To get there, we need to make mem2reg actually capable of
promoting allocas which *look* promotable to SROA without have SROA do
tons of work to massage the code into just the right form.

This is actually the tip of the iceberg. There are tremendous potential
savings we can realize here by de-duplicating work between mem2reg and
SROA.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187191 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-26 08:20:39 +00:00
..
BasicBlockUtils.cpp Use SmallVectorImpl::iterator/const_iterator instead of SmallVector to avoid specifying the vector size. 2013-07-04 01:31:24 +00:00
BreakCriticalEdges.cpp
BuildLibCalls.cpp
BypassSlowDivision.cpp
CloneFunction.cpp Extend RemapInstruction and friends to take an optional new parameter, a ValueMaterializer. 2013-05-28 15:17:05 +00:00
CloneModule.cpp
CMakeLists.txt Rename BlackList class to SpecialCaseList and move it to Transforms/Utils. 2013-07-09 22:02:49 +00:00
CmpInstAnalysis.cpp
CodeExtractor.cpp Use SmallVectorImpl::iterator/const_iterator instead of SmallVector to avoid specifying the vector size. 2013-07-04 01:31:24 +00:00
DemoteRegToStack.cpp
InlineFunction.cpp
InstructionNamer.cpp
IntegerDivision.cpp
LCSSA.cpp
LLVMBuild.txt
Local.cpp Fix spelling 2013-07-23 22:20:57 +00:00
LoopSimplify.cpp Rename LoopSimplify.h to LoopUtils.h 2013-05-20 20:46:30 +00:00
LoopUnroll.cpp
LoopUnrollRuntime.cpp
LowerExpectIntrinsic.cpp
LowerInvoke.cpp Access the TargetLoweringInfo from the TargetMachine object instead of caching it. The TLI may change between functions. No functionality change. 2013-06-19 21:07:11 +00:00
LowerSwitch.cpp
Makefile
Mem2Reg.cpp
MetaRenamer.cpp Add 'const' qualifier to some arrays. 2013-07-15 08:02:13 +00:00
ModuleUtils.cpp Respect llvm.used in Internalize. 2013-07-25 03:23:25 +00:00
PromoteMemoryToRegister.cpp Re-implement the analysis of uses in mem2reg to be significantly more 2013-07-26 08:20:39 +00:00
SimplifyCFG.cpp Use SmallVectorImpl& instead of SmallVector to avoid repeating small vector size. 2013-07-14 04:42:23 +00:00
SimplifyIndVar.cpp Don't use a potentially expensive shift if all we want is one set bit. 2013-07-11 16:05:50 +00:00
SimplifyInstructions.cpp
SimplifyLibCalls.cpp Added support for the Builtin attribute. 2013-06-27 00:25:01 +00:00
SpecialCaseList.cpp Make SpecialCaseList match full strings, as documented, using anchors. 2013-07-16 17:56:07 +00:00
SSAUpdater.cpp
UnifyFunctionExitNodes.cpp
Utils.cpp
ValueMapper.cpp Extend RemapInstruction and friends to take an optional new parameter, a ValueMaterializer. 2013-05-28 15:17:05 +00:00