[llvm] [SampleFDO] Stale profile call-graph matching (PR #95135)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 13 00:12:24 PDT 2024
================
@@ -72,34 +99,54 @@ class SampleProfileMatcher {
uint64_t MismatchedCallsiteSamples = 0;
uint64_t RecoveredCallsiteSamples = 0;
+ // Profile call-graph matching statstics:
+ uint64_t NumRecoveredUnusedSamples = 0;
+ uint64_t NumRecoveredUnusedFunc = 0;
+
// A dummy name for unknown indirect callee, used to differentiate from a
// non-call instruction that also has an empty callee name.
static constexpr const char *UnknownIndirectCallee =
"unknown.indirect.callee";
public:
- SampleProfileMatcher(Module &M, SampleProfileReader &Reader,
- const PseudoProbeManager *ProbeManager,
- ThinOrFullLTOPhase LTOPhase)
- : M(M), Reader(Reader), ProbeManager(ProbeManager), LTOPhase(LTOPhase){};
- void runOnModule();
+ SampleProfileMatcher(
+ Module &M, SampleProfileReader &Reader,
+ const PseudoProbeManager *ProbeManager, ThinOrFullLTOPhase LTOPhase,
+ HashKeyMap<std::unordered_map, FunctionId, Function *> &SymMap,
+ std::shared_ptr<ProfileSymbolList> PSL)
+ : M(M), Reader(Reader), ProbeManager(ProbeManager), LTOPhase(LTOPhase),
+ SymbolMap(&SymMap), PSL(PSL) {};
+ void runOnModule(std::vector<Function *> &OrderedFuncList);
----------------
WenleiHe wrote:
It's probably better not to have `runOnModule` not depend on a passed in ordered list. Given a module, the top-down order is deterministic. Depending on passed in order can be error prone as it's not guaranteed to be top-down.
We can have `SampleProfileMatcher` ctor take CG, and build top down order from within `runOnModule`.
https://github.com/llvm/llvm-project/pull/95135
More information about the llvm-commits
mailing list