llvm-6502/lib
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
..
Analysis Treat nothrow forms of ::operator delete and ::operator delete[] as 2013-07-21 23:11:42 +00:00
AsmParser Target/X86: Add explicit Win64 and System V/x86-64 calling conventions. 2013-07-12 06:02:35 +00:00
Bitcode Make .bc en/decoding of AttrKind stable 2013-07-26 04:16:55 +00:00
CodeGen RegAllocGreedy comment. 2013-07-25 18:35:22 +00:00
DebugInfo DebugInfo: Factor out parsing compile unit DIEs to a separate function. Improve code style and comments. 2013-07-15 08:43:35 +00:00
ExecutionEngine [PowerPC] Support powerpc64le as a syntax-checking target. 2013-07-26 01:35:43 +00:00
IR Debug Info: update comments and add a FIXME. 2013-07-25 21:19:31 +00:00
IRReader Add 'const' qualifiers to static const char* variables. 2013-07-16 01:17:10 +00:00
Linker
MC [PowerPC] Support powerpc64le as a syntax-checking target. 2013-07-26 01:35:43 +00:00
Object Remove the mblaze backend from llvm. 2013-07-25 18:55:05 +00:00
Option Silence gcc warning. 2013-07-22 21:29:28 +00:00
Support [PowerPC] Support powerpc64le as a syntax-checking target. 2013-07-26 01:35:43 +00:00
TableGen keep only the StringRef version of getFileOrSTDIN. 2013-06-25 05:28:34 +00:00
Target Fix more Intel syntax issues with FP instruction aliases. Test cases coming in a subsequent patch. 2013-07-26 05:37:46 +00:00
Transforms Re-implement the analysis of uses in mem2reg to be significantly more 2013-07-26 08:20:39 +00:00
CMakeLists.txt Move lib/Archive to tools/llvm-ar. 2013-06-17 15:47:20 +00:00
LLVMBuild.txt Move lib/Archive to tools/llvm-ar. 2013-06-17 15:47:20 +00:00
Makefile Move lib/Archive to tools/llvm-ar. 2013-06-17 15:47:20 +00:00