[llvm] [SampleFDO] Stale profile call-graph matching (PR #95135)
Lei Wang via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 17 16:28:25 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;
----------------
wlei-llvm wrote:
Note that this is not only to do the check, but also find the function that doesn't have profile("new " function). Maybe change to `FindIfFunctionIsNew`? if the `return` type is not nullptr, then call `functionMatchesProfile`
https://github.com/llvm/llvm-project/pull/95135
More information about the llvm-commits
mailing list