[llvm] [JumpThreading] Materialize PHIs in duplicateCondBranchOnPHIIntoPred (PR #204859)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 23 07:31:28 PDT 2026


================
@@ -2792,10 +2796,15 @@ bool JumpThreadingPass::duplicateCondBranchOnPHIIntoPred(
 
   // Remove the unconditional branch at the end of the PredBB block.
   OldPredBranch->eraseFromParent();
-  if (auto *BPI = getBPI())
-    BPI->copyEdgeProbabilities(BB, PredBB);
   DTU->applyUpdatesPermissive(Updates);
 
+  BasicBlock *ThreadBB = PredBB;
+  if (PredBB != OldPredBB && MergeBlockIntoPredecessor(PredBB, DTU.get()))
----------------
nikic wrote:

This needs to use the overload that accepts DTU. If you do DTU.get() you're flushing the dominator tree.

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


More information about the llvm-commits mailing list