diff options
author | Nadav Rotem <nrotem@apple.com> | 2013-07-17 00:48:31 +0000 |
---|---|---|
committer | Nadav Rotem <nrotem@apple.com> | 2013-07-17 00:48:31 +0000 |
commit | a38edf071dbc76b2e0525485ea4c368cee908373 (patch) | |
tree | 6013309c6dd05c636af9e3f177ac1579e690996c | |
parent | fe47bf8fa07e12b70ff8b234fa1f6b97c8d2753d (diff) | |
download | external_llvm-a38edf071dbc76b2e0525485ea4c368cee908373.zip external_llvm-a38edf071dbc76b2e0525485ea4c368cee908373.tar.gz external_llvm-a38edf071dbc76b2e0525485ea4c368cee908373.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186479 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/Vectorize/SLPVectorizer.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/lib/Transforms/Vectorize/SLPVectorizer.cpp b/lib/Transforms/Vectorize/SLPVectorizer.cpp index 572f343..8a1c5b7 100644 --- a/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/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) { |