[PATCH] D20789: Consecutive memory access in Loop Vectorizer - fixed and simplified

Elena Demikhovsky via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 20 10:20:06 PDT 2016


delena added inline comments.

================
Comment at: ../lib/Transforms/Vectorize/LoopVectorize.cpp:2158-2176
@@ -2157,13 +2157,21 @@
 
 int LoopVectorizationLegality::isConsecutivePtr(Value *Ptr) {
+
+  if (getSymbolicStrides()) {
+    int Stride = getPtrStride(PSE, Ptr, TheLoop, *(getSymbolicStrides()), true,
+                              false);
+    if (Stride == 1 || Stride == -1)
+      return Stride;
+    return 0;
+  }
   assert(Ptr->getType()->isPointerTy() && "Unexpected non-ptr");
   auto *SE = PSE.getSE();
   // Make sure that the pointer does not point to structs.
   if (Ptr->getType()->getPointerElementType()->isAggregateType())
     return 0;
 
   // If this value is a pointer induction variable, we know it is consecutive.
   PHINode *Phi = dyn_cast_or_null<PHINode>(Ptr);
   if (Phi && Inductions.count(Phi)) {
     InductionDescriptor II = Inductions[Phi];
     return II.getConsecutiveDirection();
----------------
anemet wrote:
> Also you didn't resolve the merge conflict properly.  isConsecutivePtr was just forwarding to getPtrStride in the earlier version as it should but now the entire original body has snuck back in.
You are right. I thought that getPtrStrides() will not work with empty strides set. But it works perfect..
Thanks.


Repository:
  rL LLVM

http://reviews.llvm.org/D20789





More information about the llvm-commits mailing list