[llvm] [VPlan] Replicate VPScalarIVStepsRecipe by VF outside replicate regions. (PR #170053)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 3 03:08:35 PST 2026
================
@@ -150,7 +148,7 @@ void UnrollState::addStartIndexForScalarSteps(VPScalarIVStepsRecipe *Steps,
StartIndex = Builder.createScalarCast(Instruction::SIToFP, StartIndex,
----------------
ayalz wrote:
When VPScalarIVStepsRecipe is set initially, VF is symbolic (and UF is unknown). But StartIndex is valid only during/after unrolling by UF, at which time VF is also known, i.e., constant if fixed. Is the following accurate, can be addressed in follow-up:
1. Initially, VPScalarIVStepsRecipe is an abstract recipe that defines a single VPValue representing UF*VF scalar values (starting with its first operand plus an additive step - its second operand), or UF scalar values for scalable VF. VF is symbolic, UF is implicit, StartIndex is unset and invalid at this time.
2. Then - here, when unrolling by UF, addStartIndexForScalarSteps() materializes this recipe per Part, by setting StartIndex to record Part*VF, casted to the type of the base value. VF is used now, and could be disposed of.
3. Finally, when replicating by VF, cloneForLane() further materializes this recipe per Lane, by bumping its StartIndex to record Part*VF+Lane.
VPScalarIVStepsRecipe::execute() should be simplified to compute a ternary multiply-add (VPInstruction?) of Base + Step * StartIndex, which for pointer inductions is simply a Mul (Base is 0, product is used by PtrAdd), and for unit step is simply an F/Add.
https://github.com/llvm/llvm-project/pull/170053
More information about the llvm-commits
mailing list