[llvm] [SimplifyCFG][PGO] Reuse existing `setBranchWeights` (PR #160629)
Mingming Liu via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 1 18:59:20 PDT 2025
================
@@ -672,7 +672,7 @@ CallBase &llvm::pgo::promoteIndirectCall(CallBase &CB, Function *DirectCallee,
createBranchWeights(CB.getContext(), Count, TotalCount - Count));
if (AttachProfToDirectCall)
- setBranchWeights(NewInst, {static_cast<uint32_t>(Count)},
+ setBranchWeights(NewInst, ArrayRef<uint32_t>{static_cast<uint32_t>(Count)},
----------------
mingmingl-llvm wrote:
This is a nice catch. AFAIK branch weights on direct calls are used by SampleFDO (not InstrFDO), and fitting it (using `fitWeights`) rather than truncating it should improve the profile quality.
https://github.com/llvm/llvm-project/pull/160629
More information about the llvm-commits
mailing list