[llvm] [VPlan] Add exit phi operands during initial construction (NFC). (PR #136455)

via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 22 13:32:47 PDT 2025


================
@@ -464,6 +478,12 @@ void VPlanTransforms::createLoopRegions(VPlan &Plan, Type *InductionTy,
   VPBlockUtils::connectBlocks(ScalarPH, Plan.getScalarHeader());
   if (!RequiresScalarEpilogueCheck) {
     VPBlockUtils::connectBlocks(MiddleVPBB, ScalarPH);
+    // The exit blocks are unreachable, remove their recipes to make sure no
+    // users remain that may pessimize transforms.
+    for (auto *EB : Plan.getExitBlocks()) {
+      for (VPRecipeBase &R : make_early_inc_range(*EB))
+        R.eraseFromParent();
+    }
----------------
ayalz wrote:

Deserves mentioning in createLoopRegions()'s documentation? Which indeed does much more than create loop regions.

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


More information about the llvm-commits mailing list