[llvm] [VPlan] Explicitly handle scalar pointer inductions. (PR #83068)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 18 13:15:20 PDT 2024


================
@@ -538,21 +541,53 @@ static VPValue *createScalarIVSteps(VPlan &Plan, const InductionDescriptor &ID,
     VecPreheader->appendRecipe(Step->getDefiningRecipe());
   }
 
-  VPScalarIVStepsRecipe *Steps = new VPScalarIVStepsRecipe(ID, BaseIV, Step);
+  VPScalarIVStepsRecipe *Steps = new VPScalarIVStepsRecipe(
+      BaseIV, Step, InductionOpcode,
+      FPBinOp ? FPBinOp->getFastMathFlags() : FastMathFlags());
   HeaderVPBB->insert(Steps, IP);
   return Steps;
 }
 
-/// If any user of a VPWidenIntOrFpInductionRecipe needs scalar values,
-/// provide them by building scalar steps off of the canonical scalar IV and
+/// Legalize VPWidenPointer induction, by replacing it with a PtrAdd (IndStart,
----------------
fhahn wrote:

Yes, `VPWidenPointerInductionRecipe` can only generate vector values after this change. 

I put up https://github.com/llvm/llvm-project/pull/85688 to add some more initial info about this kind of gradual lowering to the docs. What's still missing is a proper name/terminology for recipes that cannot be code-gen'd like predicated VPReplicateRecipe before introducing replicate regions and `VPWidenPointerInductionRecipe` after this change

https://github.com/llvm/llvm-project/pull/83068


More information about the llvm-commits mailing list