[PATCH] D21048: [LV] Enable vectorization of loops where the IV has an external use

Michael Kuperstein via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 14 12:38:40 PDT 2016

mkuper added inline comments.

Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:3301
@@ +3300,3 @@
+      assert(isa<PHINode>(UI) && "Expected LCSSA form");
+      if (!PrevValue) {
+        const DataLayout &DL =
wmi wrote:
> Why PrevValue is necessary? In which case OrigPhi->users() can have more than one use outside loop?
I think you're right.
LCSSA should canonicalize this to one phi per exit block, and we only vectorize loops with a single exit block right now. I'll change it, thanks!

Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:4806
@@ -4757,3 +4805,3 @@
         if (InductionDescriptor::isInductionPHI(Phi, PSE, ID)) {
           if (!addInductionPhi(Phi, ID))
             return false;
wmi wrote:
> addInductionPhi will return true anyway now. So maybe change its return val to void and remove the if?
Yes, of course, I didn't notice I removed the only false path.


More information about the llvm-commits mailing list