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

Gaƫtan Bossu via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 28 08:36:04 PST 2025


================
@@ -8318,6 +8323,15 @@ void LoopVectorizationPlanner::buildVPlansWithVPRecipes(ElementCount MinVF,
       if (CM.foldTailWithEVL())
         VPlanTransforms::runPass(VPlanTransforms::addExplicitVectorLength,
                                  *Plan, CM.getMaxSafeElements());
+
+      // See if we can convert an early exit vplan to bail out to a scalar
+      // loop if state-changing operations (like stores) are present and
+      // an exit will be taken in the next vector iteration.
+      // If not, discard the plan.
----------------
gbossu wrote:

Nit: Maybe check `Plan->shouldEarlyExitContinueInScalarLoop()` instead of `HandleEarlyExitsInScalarTail`?

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


More information about the llvm-commits mailing list