[llvm] [VPlan] Support VPWidenPointerInductionRecipes with EVL tail folding (PR #152110)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 6 02:48:33 PDT 2025
================
@@ -2177,8 +2177,21 @@ static void transformRecipestoEVLRecipes(VPlan &Plan, VPValue &EVL) {
assert(all_of(Plan.getVF().users(),
IsaPred<VPVectorEndPointerRecipe, VPScalarIVStepsRecipe,
VPWidenIntOrFpInductionRecipe>) &&
+ all_of(Plan.getVFxUF().users(),
+ [&Plan](VPUser *U) {
+ // VFxUF users must either be VPWidenPointerInductionRecipe or
+ // canonical IV increment.
+ return match(U, m_c_Binary<Instruction::Add>(
+ m_Specific(Plan.getCanonicalIV()),
+ m_Specific(&Plan.getVFxUF()))) ||
+ isa<VPWidenPointerInductionRecipe>(U);
+ }) &&
"User of VF that we can't transform to EVL.");
Plan.getVF().replaceAllUsesWith(&EVL);
+ Plan.getVFxUF().replaceUsesWithIf(&EVL, [](VPUser &U, unsigned Idx) {
+ // Don't replace the canonical IV increment.
----------------
fhahn wrote:
```suggestion
// Only replace uses in VPWidenPointerInductionRecipe; the only other possible user is the increment of the canonical induction, which must not be updated.
```
>From the code it is not clear why this specifically would not repalce canonical IV increment. Might be good to clarify iin comment or split up the assert and move it just before here?
https://github.com/llvm/llvm-project/pull/152110
More information about the llvm-commits
mailing list