[PATCH] D78911: [LV] Induction Variable does not remain scalar under tail-folding.

Ayal Zaks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 5 07:31:11 PDT 2020


Ayal added a comment.

Thanks for following-up on this!



================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:1915
   Value *ScalarIV = CreateScalarIV(Step);
   CreateSplatIV(ScalarIV, Step);
   buildScalarSteps(ScalarIV, Step, EntryVal, ID);
----------------
Is this call to CreateSplatIV() now fully redundant and can be removed? Along with fixing the above comment. All users should be scalar, vectorized IV should not be required.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:4593
+    // vector and used by the masked load/store vector instructions, thus the
+    // IV does not remain scalar.
+    if (Ind == Legal->getPrimaryInduction() && foldTailByMasking())
----------------
Regarding the comment: the primary iv will be widened rather that remaining scalar and being splatted, to be used by a vector compare rather than (which it turn will be) feeding masked vector load/stores directly.

Suffice to say here that // If tail-folding is applied, the primary induction variable will be used to feed a vector compare.
(This complements the "all users are scalar after vectorization" below.)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78911/new/

https://reviews.llvm.org/D78911





More information about the llvm-commits mailing list