[llvm] [SimplifyCFG] Fix DomTree update in `simplifySwitchWhenUMin` (PR #212008)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 26 10:04:45 PDT 2026


================
@@ -7828,9 +7828,10 @@ static bool simplifySwitchWhenUMin(SwitchInst *SI, DomTreeUpdater *DTU) {
     }
     BasicBlock *DeadCaseBB = I->getCaseSuccessor();
     DeadCaseBB->removePredecessor(BB);
-    Updates.push_back({DominatorTree::Delete, BB, DeadCaseBB});
     I = SIW.removeCase(I);
     E = SIW->case_end();
+    if (!is_contained(successors(BB), DeadCaseBB))
----------------
nikic wrote:

This could degenerate quadratically, though usually eliminateDeadSwitchCases(() will clean these up already.

If we want to avoid this we'd have to use something like NumPerSuccessorCases.

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


More information about the llvm-commits mailing list