[llvm] [SampleFDO] Stale profile call-graph matching (PR #95135)
David Li via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 12 15:14:31 PDT 2024
================
@@ -127,8 +147,37 @@ void SampleProfileMatcher::findProfileAnchors(const FunctionSamples &FS,
}
}
-LocToLocMap SampleProfileMatcher::longestCommonSequence(
- const AnchorList &AnchorList1, const AnchorList &AnchorList2) const {
+bool SampleProfileMatcher::isFunctionEqual(const FunctionId &IRFuncName,
+ const FunctionId &ProfileFuncName,
+ bool FindMatchedProfileOnly) {
+ if (IRFuncName == ProfileFuncName)
+ return true;
+ if (!SalvageUnusedProfile)
+ return false;
+ // If both IR function and profile function are new, try to match the profile
+ // function.
+
+ // Check whether IR function is new.
+ auto R = NewIRFunctions.find(IRFuncName);
+ if (R == NewIRFunctions.end() || !R->second)
+ return false;
+ Function &IRFunc = *R->second;
+ assert(FunctionId(IRFunc.getName()) != ProfileFuncName &&
+ "IR function should be different from profile function to match");
+
+ // Check whether profile function is new.
----------------
david-xl wrote:
How can a profile function be new?
https://github.com/llvm/llvm-project/pull/95135
More information about the llvm-commits
mailing list