[PATCH] D22869: [LV] Generate both scalar and vector integer induction variables

Matthew Simpson via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 28 14:36:41 PDT 2016


mssimpso added inline comments.

================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:1972
@@ -1968,3 +1971,3 @@
   // vectorization, it will remain scalar.
   if (Uniforms.count(I) || !TheLoop->contains(I))
     return true;
----------------
mkuper wrote:
> Oh, so if your only scalar users are outside the loop, then you don't want to generate a scalar IV. Makes sense.
> So you still end up with an extract from the vector IV, right?
> 
> Anyway, if all what you want to check is whether the user is in the loop, why are you checking isLoopInvariant and not Contains (like isScalarAfterVectorization does)?
> So you still end up with an extract from the vector IV, right?
I don't think so. If there is a user of the induction variable outside the loop (but no scalar users in the loop), yes, the induction variable would remain vector. The external induction variable users are handled in fixupIVUsers (this was recently added I think). And I think the fixup's are based on the canonical induction variable.

> Anyway, if all what you want to check is whether the user is in the loop, why are you checking isLoopInvariant and not Contains (like isScalarAfterVectorization does)?
isLoopInvariant does the additional check that the value is an instruction. But I'm thinking we should just cast the user to an instruction here and use Contains. That should make this more clear. I'll update the patch.


https://reviews.llvm.org/D22869





More information about the llvm-commits mailing list