[PATCH] D19258: Loop vectorization with induction variable with non-constant step.

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 26 15:38:41 PDT 2016


hfinkel added inline comments.

================
Comment at: ../lib/Transforms/Utils/LoopUtils.cpp:738-739
@@ +737,4 @@
+  else {
+    SetVector<Value *> *Set = SE->getSCEVValues(Step);
+    if (!Set || Set->size() != 1)
+      return false;
----------------
I don't think this is a good way to handle this, because we'll run into all kinds of non-trivial situations where SCEV has computed an expression for the step that does not exactly correspond to a pre-existing IR value. We won't handle those cases, and it will be nearly impossible for a user to understand why.

Instead, convert StepValue in InductionDescriptor to a const SCEV *, and then when we need the Value* when generating IR, get one from the SCEVBuilder. It will reuse an existing Value* should one exist.


Repository:
  rL LLVM

http://reviews.llvm.org/D19258





More information about the llvm-commits mailing list