[llvm] [LV] Move predication, early exit & region handling to VPlan0 (NFCI) (PR #185305)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 11 04:13:52 PDT 2026


================
@@ -8179,13 +8186,15 @@ VPlanPtr LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(
             return !CM.requiresScalarEpilogue(VF.isVector());
           },
           Range);
-  VPlanTransforms::handleEarlyExits(*Plan, Legal->hasUncountableEarlyExit());
-  VPlanTransforms::addMiddleCheck(*Plan, RequiresScalarEpilogueCheck,
-                                  CM.foldTailByMasking());
-
-  RUN_VPLAN_PASS_NO_VERIFY(VPlanTransforms::createLoopRegions, *Plan);
-  if (CM.foldTailByMasking())
-    RUN_VPLAN_PASS_NO_VERIFY(VPlanTransforms::foldTailByMasking, *Plan);
+  // Update the branch in the middle block if a scalar epilogue is required.
+  auto *MiddleVPBB = Plan->getMiddleBlock();
+  if (!RequiresScalarEpilogueCheck && MiddleVPBB->getNumSuccessors() == 2) {
+    auto *MiddleVPBB = Plan->getMiddleBlock();
----------------
lukel97 wrote:

Redundant MiddleVPBB?
```suggestion
```

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


More information about the llvm-commits mailing list