[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:45 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();
+ }
return;
}
----------------
ayalz wrote:
The case
```
// 2) If we require a scalar epilogue, there is no conditional branch as
// we unconditionally branch to the scalar preheader. Do nothing.
```
is handle by early return above. Better place the explanation earlier, and replace "Do nothing" with "Empty the unreachable exit blocks of their recipes". The connection from scalar loop to exit blocks is (currently) outside of VPlan's scope.
https://github.com/llvm/llvm-project/pull/136455
More information about the llvm-commits
mailing list