[llvm] [VPlan] Move IV predicate handling to VPlan. (PR #192876)

Mel Chen via llvm-commits llvm-commits at lists.llvm.org
Mon May 4 02:49:13 PDT 2026


================
@@ -6947,6 +6956,21 @@ void LoopVectorizationPlanner::buildVPlansWithVPRecipes(ElementCount MinVF,
     return;
 
   RUN_VPLAN_PASS(VPlanTransforms::simplifyRecipes, *VPlan0);
+
+  // Add surviving induction predicates to PSE and check constraints.
+  // TODO: Run after removeDeadRecipes to drop predicates from dead IVs.
+  bool ForceVectorization = Hints.getForce() == LoopVectorizeHints::FK_Enabled;
+  bool OptForSize =
+      !ForceVectorization &&
+      (CM.EpilogueLoweringStatus == CM_EpilogueNotAllowedOptSize ||
+       CM.EpilogueLoweringStatus == CM_EpilogueNotAllowedLowTripLoop);
----------------
Mel-Chen wrote:

Why is this related to epilogue strategies?
BTW, could we reuse `Config.OptForSize` since I saw this comment:
```
    LoopVectorizationLegality LVL(L, PSE, DT, TTI, TLI, F, *LAIs, LI, ORE,
                                  &Requirements, &Hints, DB, AC,
                                  /*AllowRuntimeSCEVChecks=*/!OptForSize, AA);
```

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


More information about the llvm-commits mailing list