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

Gaƫtan Bossu via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 17 01:57:41 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:

To avoid calling a setter here and when duplicating a plan, could you add a `EarlyExitContinuesInScalarLoop` parameter to `VPlanTransforms::buildVPlan0` and `VPlan`'s constructor instead?

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


More information about the llvm-commits mailing list