summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
diff options
context:
space:
mode:
authorNadav Rotem <nrotem@apple.com>2013-07-17 00:48:31 +0000
committerNadav Rotem <nrotem@apple.com>2013-07-17 00:48:31 +0000
commit2202317fce579d7675f5c591b6360e5ecca58545 (patch)
tree1e7100aff8605f48f680878d3e6b9113fb9fc469 /llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
parenta7c54e8cf42a1747e253f2559f805a8ead34813c (diff)
downloadbcm5719-llvm-2202317fce579d7675f5c591b6360e5ecca58545.tar.gz
bcm5719-llvm-2202317fce579d7675f5c591b6360e5ecca58545.zip
SLPVectorizer: Accelerate the isConsecutive check by replacing the subtraction of the two values with a simple SCEV expression that adds the offset to one of the pointers that we compare.
llvm-svn: 186479
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp')
-rw-r--r--llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 572f3436804..8a1c5b7bca9 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -1004,19 +1004,14 @@ bool BoUpSLP::isConsecutiveAccess(Value *A, Value *B) {
// Calculate the distance.
const SCEV *PtrSCEVA = SE->getSCEV(PtrA);
const SCEV *PtrSCEVB = SE->getSCEV(PtrB);
- const SCEV *OffsetSCEV = SE->getMinusSCEV(PtrSCEVB, PtrSCEVA);
- const SCEVConstant *ConstOffSCEV = dyn_cast<SCEVConstant>(OffsetSCEV);
-
- // Non constant distance.
- if (!ConstOffSCEV)
- return false;
-
- int64_t Offset = ConstOffSCEV->getValue()->getSExtValue();
Type *Ty = cast<PointerType>(PtrA->getType())->getElementType();
- // The Instructions are consecutive if the size of the first load/store is
+ // The instructions are consecutive if the size of the first load/store is
// the same as the offset.
int64_t Sz = DL->getTypeStoreSize(Ty);
- return (Offset == Sz);
+
+ const SCEV *C = SE->getConstant(PtrSCEVA->getType(), Sz);
+ const SCEV *X = SE->getAddExpr(PtrSCEVA, C);
+ return X == PtrSCEVB;
}
Value *BoUpSLP::getSinkBarrier(Instruction *Src, Instruction *Dst) {
OpenPOWER on IntegriCloud