[PATCH] D12286: [LV] Never widen an induction variable.

Adam Nemet via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 28 10:02:21 PDT 2015


anemet added a comment.

Please upload with full context.  Because it's on top of the previous patch, I tried to review this but it's basically impossible.

I have a few early comments/questions though:


================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:2683-2692
@@ -2682,12 +2693,1 @@
 
-  // We may need to extend the index in case there is a type mismatch.
-  // We know that the count starts at zero and does not overflow.
-  if (Count->getType() != IdxTy) {
-    // The exit count can be of pointer type. Convert it to the correct
-    // integer type.
-    if (ExitCount->getType()->isPointerTy())
-      Count = BypassBuilder.CreatePointerCast(Count, IdxTy, "ptrcnt.to.int");
-    else
-      Count = BypassBuilder.CreateZExtOrTrunc(Count, IdxTy, "cnt.cast");
-  }
-
----------------
Is this becoming dead as a consequence of not widening indvars or was this code dead even before?  I *think* it's the latter in which case it should be a separate patch to minimize confusion.

================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:3416-3417
@@ +3415,4 @@
+      // canonical one.
+      auto *V = Builder.CreateSExtOrTrunc(Induction, P->getType());
+      V = II.transform(Builder, V);
+      V->setName("offset.idx");
----------------
These steps seem unnecessary if P == OldInduction, no?


Repository:
  rL LLVM

http://reviews.llvm.org/D12286





More information about the llvm-commits mailing list