[PATCH] D158680: RFC: Interpet {branch_weights 1, 0} as likely/unlikely

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 24 10:32:13 PDT 2023


MatzeB marked an inline comment as done.
MatzeB added inline comments.


================
Comment at: llvm/test/Transforms/SampleProfile/profile-inference.ll:215
 ; CHECK:  edge b6 -> b8 probability is 0x80000000 / 0x80000000 = 100.00%
-; CHECK2: - b6: float = {{.*}}, int = {{.*}}, count = 0
+; CHECK2: - b6: float = {{.*}}, int = {{.*}}, count = 3
 
----------------
mtrofin wrote:
> this caught my eye - how did count = 0 get to count = 3?
This comes from the fact that `!{"branch_weights", i32 X, i32 0}` gets interpreted as `!{"branch_weights", i32 LikelyBranchWeight, i32 1}` now. So absolutes like a branch count / block being always zero is no longer the case.

I was contemplating whether there is/should be a difference between a branch reported as 0 by profile information or a branch marked as [[unlikely]]...

I don't know myself whether this change is actually a good idea (so at the moment no plans of landing it). But I thought it would make for an interesting RFC / strawman and elicit comments from people who have worked on profiling in the past.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158680/new/

https://reviews.llvm.org/D158680



More information about the llvm-commits mailing list