[llvm] [LV] Transform to handle exits in the scalar loop (PR #148626)

Gaƫtan Bossu via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 4 02:51:24 PST 2025


================
@@ -8202,6 +8205,8 @@ void LoopVectorizationPlanner::buildVPlansWithVPRecipes(ElementCount MinVF,
   auto VPlan0 = VPlanTransforms::buildVPlan0(
       OrigLoop, *LI, Legal->getWidestInductionType(),
       getDebugLocFromInstOrOperands(Legal->getPrimaryInduction()), PSE);
+  VPlan0->setEarlyExitContinuesInScalarLoop(Legal->hasUncountableEarlyExit() &&
+                                            HandleEarlyExitsInScalarTail);
----------------
gbossu wrote:

I think setters should be avoided because they allow multiple points of (re)definition, which makes the data flow harder to follow.

Adding a `EarlyExitContinuesInScalarLoop` parameter to the plan's constructor makes it obvious we now have an additional lever to control the vectorisation strategy.

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


More information about the llvm-commits mailing list