[PATCH] D21903: [LV] Refactor integer induction widening (NFC)

Adam Nemet via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 1 13:03:29 PDT 2016


anemet accepted this revision.
anemet added a comment.
This revision is now accepted and ready to land.

Great clean-up!  I have a few minor suggestions below.


================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:2207-2209
@@ +2206,5 @@
+                                            IntegerType *TruncType) {
+  assert(Legal->getInductionVars()->count(IV) && "IV is not an induction");
+
+  auto II = Legal->getInductionVars()->lookup(IV);
+  auto &DL = OrigLoop->getHeader()->getModule()->getDataLayout();
----------------
Can we do a single look-up in an assert-enabled build?  I.e. assert(II != end() ...)


================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:2216
@@ +2215,3 @@
+  // induction variable.
+  Value *Init = nullptr;
+
----------------
Init is a bit confusing in this context.  How about ScalarIV?  I think that you can also move this down to after the call to createVectorIntInductionPHI.

================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:4451
@@ +4450,3 @@
+      // (c) other casts depend on pointer size.
+      auto II = Legal->getInductionVars()->lookup(OldInduction);
+      if (isa<TruncInst>(CI) && CI->getOperand(0) == OldInduction &&
----------------
I would rename II to ID or something since it's not an iterator but an InductionDescriptor.


http://reviews.llvm.org/D21903





More information about the llvm-commits mailing list