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

David Li via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 2 09:56:32 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
----------------
david-xl wrote:

It helps to add a brief description of the transformation (with a simple ascii art) to reason about weight update strategy. 

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


More information about the llvm-commits mailing list