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

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 28 06:56:00 PDT 2025


================
@@ -1891,10 +1908,14 @@ class VPWidenIntOrFpInductionRecipe : public VPWidenInductionRecipe {
   VPValue *getVFValue() { return getOperand(2); }
   const VPValue *getVFValue() const { return getOperand(2); }
 
+  VPValue *getStepVector() { return getOperand(3); }
+  const VPValue *getStepVector() const { return getOperand(3); }
+  void setStepVector(VPValue *V) { setOperand(3, V); }
+
   VPValue *getSplatVFValue() {
-    // If the recipe has been unrolled (4 operands), return the VPValue for the
+    // If the recipe has been unrolled, return the VPValue for the
     // induction increment.
-    return getNumOperands() == 5 ? getOperand(3) : nullptr;
+    return isUnrolled() ? getOperand(getNumOperands() - 2) : nullptr;
----------------
lukel97 wrote:

Agreed, I've opened up https://github.com/llvm/llvm-project/pull/137635

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


More information about the llvm-commits mailing list