Handle constants without going through SCEV.
authorNadav Rotem <nrotem@apple.com>
Thu, 18 Jul 2013 18:34:21 +0000 (18:34 +0000)
committerNadav Rotem <nrotem@apple.com>
Thu, 18 Jul 2013 18:34:21 +0000 (18:34 +0000)
llvm-svn: 186593

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

index 3629eee..f1da774 100644 (file)
@@ -1033,6 +1033,12 @@ bool BoUpSLP::isConsecutiveAccess(Value *A, Value *B) {
   if (GepA && GepA->getPointerOperand() == PtrB)
     return false;
 
+  ConstantInt *CA = dyn_cast<ConstantInt>(PtrA);
+  ConstantInt *CB = dyn_cast<ConstantInt>(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);