Skip to content

Commit 0d5325b

Browse files
authored
[BOLT] Directly use call count in buildCallGraph (#134966)
In call graph construction, call block count is used for call graph edge weight. Change that to use call count directly if it's available, falling back to block count if not. Test Plan: This change together with disabling `fix-block-counts` improves profile quality metrics, e.g. for large binaries and sampled LBR profiles: `br_inst_retired.near_taken:uppp` trigger event - Ads1: - Profiled functions 58096 - CFG imbalance 2.63% -> 2.45% - CG imbalance 8.23% -> 7.44% - Ads2: - Profiled functions 54358 - CFG imbalance 3.12% -> 2.77% - CG imbalance 8.22% -> 7.06% - uwsgi: - Profiled functions 78103 - CFG imbalance 4.42% -> 4.03% - CG imbalance 100.00% -> 100.00% `cycles:u` trigger event: - web: - Profiled functions 31306 - CG flow imbalance: 31.16% -> 20.29% - CFG flow imbalance: 7.04% -> 6.44%
1 parent 834591e commit 0d5325b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

bolt/lib/Core/BinaryFunctionCallGraph.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,8 @@ buildCallGraph(BinaryContext &BC, CgFilterFunction Filter, bool CgFromPerfData,
200200
if (CSI.Symbol)
201201
Counts.emplace_back(CSI.Symbol, CSI.Count);
202202
} else {
203-
const uint64_t Count = BB->getExecutionCount();
203+
const uint64_t Count = BC.MIB->getAnnotationWithDefault(
204+
Inst, "Count", BB->getExecutionCount());
204205
Counts.emplace_back(DstSym, Count);
205206
}
206207

0 commit comments

Comments
 (0)