[llvm] [VPlan] Introduce VPCumulativeIVPHIRecipe for variable-length stepping (PR #177114)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 21 02:16:58 PST 2026
================
@@ -567,6 +586,8 @@ static void addInitialSkeleton(VPlan &Plan, Type *InductionTy, DebugLoc IVDL,
{VectorPhiR, VectorPhiR->getOperand(0)}, VectorPhiR->getDebugLoc());
cast<VPIRPhi>(&ScalarPhiR)->addOperand(ResumePhiR);
}
+
+ addCumulativeIVRecipes(Plan, HeaderVPBB, LatchVPBB, InductionTy, IVDL);
----------------
lukel97 wrote:
> An alternative approach would be to only create it after variable-length transforms (e.g., addExplicitVectorLength), and have getCumulativeIV() fall back to CanonicalIV when CumulativeIV doesn't exist.
> Would that be preferable?
Yes, I think that's what I had in mind. That way we don't change any VPlans that don't care about CumulativeIV, and we don't need removeFixedStepCumulativeIV.
What we could also even do in a prior NFC is to add VPRegionBlock::getCumulativeIV, returning just getCanonicalIV() for now, and go through every caller of getCanonicalIV() and check if it should be moved to getCumulativeIV().
Then in this PR you can have make getCumulativeIV() return VPCumulativeIVPHIRecipe when it exists
https://github.com/llvm/llvm-project/pull/177114
More information about the llvm-commits
mailing list