[llvm] Change how branch weight is annotated for direct call (PR #90315)

via llvm-commits llvm-commits at lists.llvm.org
Thu May 2 22:25:35 PDT 2024


WenleiHe wrote:

> Say the binary being profiled has an indirect call and the sample profile has an indirect target profile for the site. In thinLTO prelink compilation, the indirect call is indirect call promoted resulting with if-then-else in which 'then' branch has a direct call. In the postlink compilation, when the sample profile is loaded, it is better to use the call count to annotate the block.

When doing ICP, we should distribute counts to the generated if-then-else as part of profile maintenance. Specifically, the generated block for the direct call should get the correct call counts as part of ICP for that target. In that case, post-link won't try to overwrite existing counts anyways. 

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


More information about the llvm-commits mailing list