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

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 28 06:12:51 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;
----------------
david-arm wrote:

The changes in `getSplatVFValue` and `getLastUnrolledPartOperand` seem sensible and could be done in an independent patch I think?

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


More information about the llvm-commits mailing list