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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue May 5 10:43:52 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);
----------------
fhahn wrote:

This matches the existing behavior, where we prevent vectorizaiton for either of the 2 options above. Renamed to variable to more accurately reflect that it checks if no epilogue is allowed.

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


More information about the llvm-commits mailing list