[llvm] [SampleFDO] Stale profile call-graph matching (PR #95135)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 16 12:09:50 PDT 2024
================
@@ -127,8 +147,37 @@ void SampleProfileMatcher::findProfileAnchors(const FunctionSamples &FS,
}
}
-LocToLocMap SampleProfileMatcher::longestCommonSequence(
- const AnchorList &AnchorList1, const AnchorList &AnchorList2) const {
+bool SampleProfileMatcher::functionMatchesProfile(
+ const FunctionId &IRFuncName, const FunctionId &ProfileFuncName,
+ bool FindMatchedProfileOnly) {
+ if (IRFuncName == ProfileFuncName)
+ return true;
+ if (!SalvageUnusedProfile)
+ return false;
+ // If IR function and profile function don't appear on either side, try
+ // matching the profile function.
+
+ // Check whether IR function appears in profile.
+ auto R = NewIRFunctions.find(IRFuncName);
+ if (R == NewIRFunctions.end() || !R->second)
+ return false;
----------------
WenleiHe wrote:
Same as below, a match is a match, perhaps this can be split into `functionHasProfile` (hence no need to match) + `functionMatchesProfile`.
https://github.com/llvm/llvm-project/pull/95135
More information about the llvm-commits
mailing list