[llvm] [VPlan] Add VPInstruction::StepVector and use it in VPWidenIntOrFpInductionRecipe (PR #129508)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 22 00:54:45 PDT 2025


================
@@ -1836,6 +1841,7 @@ class VPWidenIntOrFpInductionRecipe : public VPWidenInductionRecipe {
                                Step, IndDesc, DL),
         Trunc(nullptr) {
     addOperand(VF);
+    addOperand(VF); // Dummy StepVector replaced in convertToConcreteRecipes
----------------
lukel97 wrote:

I tried adding the operands at the call site this again and it ends up needing a bunch more code because we have to create the step vector in both createWidenInductionRecipes and tryToConvertVPInstructionsToVPRecipes, and also we need to recreate it again in optimizeVectorInductionWidthForTCAndVFUF if the bitwidth is reduced. 

It also doesn't really work well when the operand is added in `convertToConcreteRecipes` because then getLastUnrolledPartOperand` and `getSplatVFValue` get confused with the number of operands in `isUnrolled` . 

The dummy operand would hopefully only be temporary and would go away with https://github.com/llvm/llvm-project/pull/118638 whenever the recipe is fully expanded.

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


More information about the llvm-commits mailing list