[clang] [llvm] [SimplifyCFG] Hoist common code for switch multi-case destinations (PR #165700)
Nikita Popov via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 30 13:32:36 PDT 2025
================
@@ -2156,9 +2164,13 @@ bool SimplifyCFGOpt::hoistSuccIdenticalTerminatorToSwitchOrIf(
Updates.push_back({DominatorTree::Insert, TIParent, Succ});
}
- if (DTU)
- for (BasicBlock *Succ : successors(TI))
+ if (DTU) {
+ // TI might be a switch with multi-cases destination, so we need to care for
+ // the duplication of successors.
+ SmallPtrSet<BasicBlock *, 4> UniqSuccs(llvm::from_range, successors(TI));
----------------
nikic wrote:
Why can't we use the existing UniqSuccessors here and need to compute it again?
https://github.com/llvm/llvm-project/pull/165700
More information about the cfe-commits
mailing list