[llvm] [ControlFlowHub] Fix duplicate DomTree updates when branch successors are identical (PR #176620)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 18 12:58:11 PST 2026
================
@@ -248,6 +250,11 @@ static void reconnectPhis(BasicBlock *Out, BasicBlock *GuardBlock,
Value *V = PoisonValue::get(Phi->getType());
if (Phi->getBasicBlockIndex(BB) != -1) {
V = Phi->removeIncomingValue(BB, false);
+ // When both successors are the same (Succ0 == Succ1), there are two
+ // edges from BB to Out, so we need to remove the second PHI entry too.
+ if (Succ0 && Succ1 && Succ0 == Succ1 &&
+ Phi->getBasicBlockIndex(BB) != -1)
+ Phi->removeIncomingValue(BB, false);
----------------
arsenm wrote:
This is calling Phi->removeIncomingValue(BB, false) a second time?
https://github.com/llvm/llvm-project/pull/176620
More information about the llvm-commits
mailing list