[llvm] [VPlan] Simplify Plan's entry in removeBranchOnConst. (PR #154510)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 15 00:46:31 PDT 2025
================
@@ -969,12 +969,25 @@ void VPlan::execute(VPTransformState *State) {
setName("Final VPlan");
LLVM_DEBUG(dump());
- // Disconnect scalar preheader and scalar header, as the dominator tree edge
- // will be updated as part of VPlan execution. This allows keeping the DTU
- // logic generic during VPlan execution.
BasicBlock *ScalarPh = State->CFG.ExitBB;
- State->CFG.DTU.applyUpdates(
- {{DominatorTree::Delete, ScalarPh, ScalarPh->getSingleSuccessor()}});
+ if (getScalarPreheader()->hasPredecessors()) {
+ // Disconnect scalar preheader and scalar header, as the dominator tree edge
+ // will be updated as part of VPlan execution. This allows keeping the DTU
+ // logic generic during VPlan execution.
+ State->CFG.DTU.applyUpdates(
+ {{DominatorTree::Delete, ScalarPh, ScalarPh->getSingleSuccessor()}});
+ } else {
+ Loop *OrigLoop = State->LI->getLoopFor(
+ cast<VPIRBasicBlock>(getScalarPreheader()->getSingleSuccessor())
+ ->getIRBasicBlock());
----------------
fhahn wrote:
done thanks
https://github.com/llvm/llvm-project/pull/154510
More information about the llvm-commits
mailing list