[llvm] [SampleFDO] Read call-graph matching recovered top-level function profile (PR #101053)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 15 17:34:40 PDT 2024
================
@@ -782,6 +782,25 @@ bool SampleProfileMatcher::functionMatchesProfileHelper(
float Similarity = 0.0;
const auto *FSFlattened = getFlattenedSamplesFor(ProfFunc);
+ // With extbinary profile format, initial profile loading only reads profile
+ // based on current function names in the module.
+ // However, if a function is renamed, sample loader fails to load its original
+ // profile(which has a different name), we will miss this case. To address
+ // this, we load the top-level profile candidate explicitly for the matching.
+ if (!FSFlattened) {
+ DenseSet<StringRef> TopLevelFunc({ProfFunc.stringRef()});
+ SampleProfileMap TopLevelProfile;
+ Reader.read(TopLevelFunc, TopLevelProfile);
----------------
WenleiHe wrote:
This will actually return not_implemented for other format, we should probably check success before proceeding the following logic to read profile, to make it explicit.
https://github.com/llvm/llvm-project/pull/101053
More information about the llvm-commits
mailing list