diff options
author | Nadav Rotem <nrotem@apple.com> | 2013-07-18 18:20:45 +0000 |
---|---|---|
committer | Nadav Rotem <nrotem@apple.com> | 2013-07-18 18:20:45 +0000 |
commit | de2815a5f705d0b4dc86a4af992e2a10b772ef71 (patch) | |
tree | ee199be77aea37f7fecd8b261b59c9eaf92f10c1 /llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | |
parent | c2cbc66e7a09a0174b15c68ac745d7bb4b3dcc63 (diff) | |
download | bcm5719-llvm-de2815a5f705d0b4dc86a4af992e2a10b772ef71.tar.gz bcm5719-llvm-de2815a5f705d0b4dc86a4af992e2a10b772ef71.zip |
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.
llvm-svn: 186592
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp')
-rw-r--r-- | llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index 64987840353..3629eeec173 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/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. |