[llvm] [SampleFDO] Read call-graph matching recovered top-level function profile (PR #101053)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 8 10:59:04 PDT 2024
================
@@ -863,6 +883,39 @@ bool SampleProfileMatcher::functionMatchesProfile(Function &IRFunc,
return Matched;
}
+void SampleProfileMatcher::UpdateSampleLoaderWithRecoveredProfiles() {
+ DenseSet<StringRef> RecoveredFuncs;
+ // Update FuncNameToProfNameMap and SymbolMap.
+ for (auto &I : FuncToProfileNameMap) {
+ assert(I.first && "New function is null");
+ FunctionId FuncName(I.first->getName());
+ RecoveredFuncs.insert(I.second.stringRef());
+ FuncNameToProfNameMap->emplace(FuncName, I.second);
+
+ // We need to remove the old entry to avoid duplicating the function
+ // processing.
+ SymbolMap->erase(FuncName);
+ SymbolMap->emplace(I.second, I.first);
+ }
+
+ // Read the top-level profiles for the recovered function profiles. This is
----------------
WenleiHe wrote:
"recovered function" can be unclear it means, how about "function with different profile name"?
The comment also reads a bit unclear, how about this
"
With extbinary profile format, initial profile loading only reads profile based on current function names in the module, so we need to load top-level profiles for functions with different profile name explicitly after function-profile name map is established with stale profile matching.
"
https://github.com/llvm/llvm-project/pull/101053
More information about the llvm-commits
mailing list