[llvm] [SimplifyCFG][PGO] Reuse existing `setBranchWeights` (PR #160629)

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 30 10:44:08 PDT 2025


================
@@ -209,10 +209,10 @@ loop_exit:
 
 ; IR-LABEL: define void @func5_zero_branch_weight
 ; IR: entry:
-; IR:   br i1 %cmp1, label %loop_exit, label %loop_body.lr.ph, !prof [[PROF_FUNC5_0:![0-9]+]]
+; IR:   br i1 %cmp1, label %loop_exit, label %loop_body.lr.ph
----------------
MatzeB wrote:

I think stricly speaking branch weights (0, 0) is equivalent to (1,1) or (2,2), no? While this feels like it has some "unreachable" code vibe to it, I don't think that is used by anything / influences anything? And for all I know we make no effort to normalize (2,2) to (1,1) either, so may just as well keep (0,0) around too?

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


More information about the llvm-commits mailing list