[llvm] [SimplifyCFG] Probabilities associated with same condition are constant (PR #155734)

Mircea Trofin via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 2 10:05:07 PDT 2025


================
@@ -4808,23 +4808,12 @@ static bool SimplifyCondBranchToCondBranch(BranchInst *PBI, BranchInst *BI,
       SelectInst *NV = cast<SelectInst>(
           Builder.CreateSelect(PBICond, PBIV, BIV, PBIV->getName() + ".mux"));
       PN.setIncomingValue(PBBIdx, NV);
-      // Although the select has the same condition as PBI, the original branch
-      // weights for PBI do not apply to the new select because the select's
-      // 'logical' edges are incoming edges of the phi that is eliminated, not
-      // the outgoing edges of PBI.
+      // The select has the same condition as PBI. The probabilities don't
----------------
mtrofin wrote:

Here, the point is that it's irrespective of what's happening in the transformation, because the probabilities have to do with the value distribution of the condition of the conditional branch.

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


More information about the llvm-commits mailing list