[PATCH] D28490: [LV] Don't panic when encountering the IV of an outer loop.

Matthew Simpson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 10 08:24:37 PST 2017


mssimpso added inline comments.


================
Comment at: test/Transforms/LoopVectorize/pr31190.ll:8
+
+; CHECK: LV: PHI is a recurrence with respect to an outer loop.
+; CHECK: LV: Not vectorizing: Cannot prove legality.
----------------
mkuper wrote:
> delena wrote:
> > Can you add the source code to the comments? You try to vectorize the "for.body3" loop, right? What PHI belongs to the outer loop?
> Yes, it's trying to vectorize the inner loop (for.body3).
> The problematic PHI is: 
> %0 = phi i32 [ undef, %for.cond1.preheader ], [ %inc54, %for.body3 ]
> 
> This phi is in the inner loop, but %inc54 is an IV phi in the outer loop:
> %inc54 = phi i32 [ %inc5, %for.cond1.for.inc4_crit_edge ], [ %c.promoted, %entry ]
> So SCEV recognizes %0 as an AddRec, but with respect to the outer loop.
> 
> I'll add the above explanation in a comment.
> Not sure about the source, though - the IR was, I think, hand-reduced by @davide from the source in PR31190, so I'm not sure having the "original" source he makes a lot of sense.
> 
> So SCEV recognizes %0 as an AddRec, but with respect to the outer loop.

I haven't tried this so I'm not really sure, but would SE->getSCEVAtScope(Phi, TheLoop) be useful here?


https://reviews.llvm.org/D28490





More information about the llvm-commits mailing list