[PATCH] D120828: [LV] Create & use VPScalarIVSteps for all scalar users.

Ayal Zaks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 9 11:22:09 PST 2022


Ayal added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:9565
+  // required to be loop-invariant
+  auto CreateStepValue = [&](const SCEV *Step) -> Value * {
+    if (SE.isSCEVable(IV->getType())) {
----------------
fhahn wrote:
> Ayal wrote:
> > We're losing the assertion for loop-invariance of step here. Worth retaining, somewhere else perhaps?
> Good point, I added it to the place where VPWidenIntOrFpInductionRecipe is created.
Very good!


================
Comment at: llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp:424
+    if (!IV->needsVectorIV()) {
+      IV->replaceAllUsesWith(Steps) continue;
+    }
----------------
'continue' on same line?

Given that we're iterating over all users below to find those that use scalars, perhaps compute if a vector IV and scalar IV are needed, removing needsVectorIV() and needsScalarIV()? Along with what they entail...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120828



More information about the llvm-commits mailing list