diff --git a/lib/Transforms/Vectorize/SLPVectorizer.cpp b/lib/Transforms/Vectorize/SLPVectorizer.cpp index 3629eeec173..f1da774ede5 100644 --- a/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -1033,6 +1033,12 @@ bool BoUpSLP::isConsecutiveAccess(Value *A, Value *B) { if (GepA && GepA->getPointerOperand() == PtrB) return false; + ConstantInt *CA = dyn_cast(PtrA); + ConstantInt *CB = dyn_cast(PtrB); + if (CA && CB) { + return (CA->getSExtValue() + Sz == CB->getSExtValue()); + } + // Calculate the distance. const SCEV *PtrSCEVA = SE->getSCEV(PtrA); const SCEV *PtrSCEVB = SE->getSCEV(PtrB);