llvm-6502/test/Transforms
Chandler Carruth c537759a7f [SROA] Fix another instability in SROA with respect to the slice
ordering.

The fundamental problem that we're hitting here is that the use-def
chain ordering is *itself* not a stable thing to be relying on in the
rewriting for SROA. Further, we use a non-stable sort over the slices to
arrange them based on the section of the alloca they're operating on.
With a debugging STL implementation (or different implementations in
stage2 and stage3) this can cause stage2 != stage3.

The specific aspect of this problem fixed in this commit deals with the
rewriting and load-speculation around PHIs and Selects. This, like many
other aspects of the use-rewriting in SROA, is really part of the
"strong SSA-formation" that is doen by SROA where it works very hard to
canonicalize loads and stores in *just* the right way to satisfy the
needs of mem2reg[1]. When we have a select (or a PHI) with 2 uses of the
same alloca, we test that loads downstream of the select are
speculatable around it twice. If only one of the operands to the select
needs to be rewritten, then if we get lucky we rewrite that one first
and the select is immediately speculatable. This can cause the order of
operand visitation, and thus the order of slices to be rewritten, to
change an alloca from promotable to non-promotable and vice versa.

The fix is to defer all of the speculation until *after* the rewrite
phase is done. Once we've rewritten everything, we can accurately test
for whether speculation will work (once, instead of twice!) and the
order ceases to matter.

This also happens to simplify the other subtlety of speculation -- we
need to *not* speculate anything unless the result of speculating will
make the alloca fully promotable by mem2reg. I had a previous attempt at
simplifying this, but it was still pretty horrible.

There is actually already a *really* nice test case for this in
basictest.ll, but on multiple STL implementations and inputs, we just
got "lucky". Fortunately, the test case is very small and we can
essentially build it in exactly the opposite way to get reasonable
coverage in both directions even from normal STL implementations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202092 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-25 00:07:09 +00:00
..
ADCE
ArgumentPromotion
BBVectorize
BranchFolding Re-commit: Demote EmitRawText call in AsmPrinter::EmitInlineAsm() and remove hasRawTextSupport() call 2014-02-13 14:44:26 +00:00
CodeExtractor
CodeGenPrepare X86: move test requiring X86TargetLowering info into its own directory 2014-02-19 12:24:19 +00:00
ConstantHoisting/X86 [Constant Hoisting] Fix insertion point for constant materialization. 2014-02-08 00:20:49 +00:00
ConstantMerge
ConstProp
CorrelatedValuePropagation
DeadArgElim Fix broken CHECK lines 2014-02-16 07:31:05 +00:00
DeadStoreElimination
DebugIR
EarlyCSE
FunctionAttrs
GCOVProfiling
GlobalDCE
GlobalOpt GlobalOpt: Aliases don't have sections, don't copy them when replacing 2014-02-13 02:18:36 +00:00
GVN
IndVarSimplify
Inline Set default of inlinecold-threshold to 225. 2014-02-06 01:59:22 +00:00
InstCombine Make sure that value handle users see the transformation of an indirect call to a direct call. This is important for the CallGraph iteration. Patch by Björn Steinbrink! 2014-02-20 23:00:15 +00:00
InstSimplify
Internalize
IPConstantProp
JumpThreading
LCSSA
LICM [LPM] Switch LICM to actively use LCSSA in addition to preserving it. 2014-02-11 12:52:27 +00:00
LoopDeletion
LoopIdiom
LoopReroll
LoopRotate
LoopSimplify [LPM] Switch LICM to actively use LCSSA in addition to preserving it. 2014-02-11 12:52:27 +00:00
LoopStrengthReduce SCEVExpander: Try hard not to create derived induction variables in other loops 2014-02-16 15:49:50 +00:00
LoopUnroll
LoopUnswitch
LoopVectorize LoopVectorizer: Keep track of conditional store basic blocks 2014-02-08 20:41:13 +00:00
LowerAtomic
LowerExpectIntrinsic Lower llvm.expect intrinsic correctly for i1 2014-02-02 22:43:55 +00:00
LowerInvoke
LowerSwitch
Mem2Reg
MemCpyOpt A memcpy out of an fresh alloca is a no-op, delete it. Patch by Patrick Walton! 2014-02-06 06:29:19 +00:00
MergeFunc
MetaRenamer
ObjCARC
PhaseOrdering
PruneEH
Reassociate
Reg2Mem
SampleProfile
Scalarizer
ScalarRepl
SCCP
SimplifyCFG
Sink
SLPVectorizer SLPVectorizer: Try vectorizing 'splat' stores 2014-02-24 19:52:29 +00:00
SROA [SROA] Fix another instability in SROA with respect to the slice 2014-02-25 00:07:09 +00:00
StripSymbols
StructurizeCFG
TailCallElim
TailDup