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

Michael Kuperstein via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 28 14:13:47 PDT 2016


mkuper added a comment.

In https://reviews.llvm.org/D22869#499751, @mssimpso wrote:

> In https://reviews.llvm.org/D22869#499700, @mkuper wrote:
>
> > Out of curiosity - what does the final generate code end up looking with and without this patch, for cases where we have both a scalar and a vector use?
> >  It seems like it should be better, I'm wondering how much.
>
>
> If you don't mind looking at the full code, I've pasted below what we generate for the new test case I've added to induction.ll (VF=2, UF=2, after instcombine).


Yes, that does look much better, thanks!
(I actually meant post-CG, but the IR looks so much better that doesn't really matter).


================
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;
----------------
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)?


https://reviews.llvm.org/D22869





More information about the llvm-commits mailing list