aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNadav Rotem <nrotem@apple.com>2013-07-18 18:20:45 +0000
committerNadav Rotem <nrotem@apple.com>2013-07-18 18:20:45 +0000
commitdfacdd04cd2dd3b474fcabc5497255548f5506d5 (patch)
treee532adfe63257a671849e843fba07223a1a69001
parent2cf5425d0a048fbf36fc15035487f427499b514a (diff)
downloadexternal_llvm-dfacdd04cd2dd3b474fcabc5497255548f5506d5.zip
external_llvm-dfacdd04cd2dd3b474fcabc5497255548f5506d5.tar.gz
external_llvm-dfacdd04cd2dd3b474fcabc5497255548f5506d5.tar.bz2
SLPVectorizer: Speedup isConsecutive by manually checking GEPs with multiple indices.
This brings the compile time of the SLP-Vectorizer to about 2.5% of OPT for my testcase. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186592 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Vectorize/SLPVectorizer.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/Transforms/Vectorize/SLPVectorizer.cpp b/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 6498784..3629eee 100644
--- a/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -1006,12 +1006,20 @@ bool BoUpSLP::isConsecutiveAccess(Value *A, Value *B) {
GepB->accumulateConstantOffset(*DL, OffsetB))
return ((OffsetB.getSExtValue() - OffsetA.getSExtValue()) == Sz);
+ if (GepA->getNumIndices() != GepB->getNumIndices())
+ return false;
+
// Try to strip the geps. This makes SCEV faster.
- if (GepA->getNumIndices() == 1 && GepB->getNumIndices() == 1) {
- PtrA = GepA->getOperand(1);
- PtrB = GepB->getOperand(1);
- Sz = 1;
+ // Make sure that all of the indices except for the last are identical.
+ int LastIdx = GepA->getNumIndices();
+ for (int i = 0; i < LastIdx - 1; i++) {
+ if (GepA->getOperand(i+1) != GepB->getOperand(i+1))
+ return false;
}
+
+ PtrA = GepA->getOperand(LastIdx);
+ PtrB = GepB->getOperand(LastIdx);
+ Sz = 1;
}
// Check if PtrA is the base and PtrB is a constant offset.