llvm/test/Transforms
Chandler Carruth 474be0d0f8 Teach the SLP vectorizer the correct way to check for consecutive access
using GEPs. Previously, it used a number of different heuristics for
analyzing the GEPs. Several of these were conservatively correct, but
failed to fall back to SCEV even when SCEV might have given a reasonable
answer. One was simply incorrect in how it was formulated.

There was good code already to recursively evaluate the constant offsets
in GEPs, look through pointer casts, etc. I gathered this into a form
code like the SLP code can use in a previous commit, which allows all of
this code to become quite simple.

There is some performance (compile time) concern here at first glance as
we're directly attempting to walk both pointers constant GEP chains.
However, a couple of thoughts:

1) The very common cases where there is a dynamic pointer, and a second
   pointer at a constant offset (usually a stride) from it, this code
   will actually not do any unnecessary work.

2) InstCombine and other passes work very hard to collapse constant
   GEPs, so it will be rare that we iterate here for a long time.

That said, if there remain performance problems here, there are some
obvious things that can improve the situation immensely. Doing
a vectorizer-pass-wide memoizer for each individual layer of pointer
values, their base values, and the constant offset is likely to be able
to completely remove redundant work and strictly limit the scaling of
the work to scrape these GEPs. Since this optimization was not done on
the prior version (which would still benefit from it), I've not done it
here. But if folks have benchmarks that slow down it should be straight
forward for them to add.

I've added a test case, but I'm not really confident of the amount of
testing done for different access patterns, strides, and pointer
manipulation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189007 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-22 12:45:17 +00:00
..
ADCE [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
ArgumentPromotion [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
BBVectorize TBAA: remove !tbaa from testing cases when they are not needed. 2013-08-21 22:20:53 +00:00
BlockPlacement [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
BranchFolding
CodeExtractor [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
CodeGenPrepare [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
ConstantMerge [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
ConstProp Teach ConstantFolding about pointer address spaces 2013-08-20 21:20:04 +00:00
CorrelatedValuePropagation [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
DeadArgElim [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
DeadStoreElimination [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
DebugIR [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
EarlyCSE [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
FunctionAttrs [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
GCOVProfiling [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
GlobalDCE [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
GlobalOpt [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
GVN [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
IndVarSimplify [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
Inline [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
InstCombine Teach InstCombine about address spaces 2013-08-21 19:53:10 +00:00
InstSimplify [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
Internalize [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
IPConstantProp [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
JumpThreading [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
LCSSA [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
LICM [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
LoopDeletion [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
LoopIdiom [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
LoopRotate [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
LoopSimplify [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
LoopStrengthReduce [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
LoopUnroll [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
LoopUnswitch [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
LoopVectorize Teach LoopVectorize about address space sizes 2013-08-22 02:42:55 +00:00
LowerAtomic [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
LowerExpectIntrinsic [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
LowerInvoke [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
LowerSwitch [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
Mem2Reg [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
MemCpyOpt [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
MergeFunc [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
MetaRenamer [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
ObjCARC [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
PhaseOrdering [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
PruneEH [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
Reassociate [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
Reg2Mem [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
ScalarRepl [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
SCCP [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
SimplifyCFG [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
Sink [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
SLPVectorizer/X86 Teach the SLP vectorizer the correct way to check for consecutive access 2013-08-22 12:45:17 +00:00
SROA [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
StripSymbols [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
StructurizeCFG [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
TailCallElim [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
TailDup [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00