[llvm] [SampleFDO] Stale profile call-graph matching (PR #92151)

via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 1 16:56:28 PDT 2024


================
@@ -160,6 +186,48 @@ class SampleProfileMatcher {
   void runStaleProfileMatching(const Function &F, const AnchorMap &IRAnchors,
                                const AnchorMap &ProfileAnchors,
                                LocToLocMap &IRToProfileLocationMap);
+  /// Find the existing or new matched function using the profile name.
+  ///
+  /// \returns The function and a match state.
+  std::pair<Function *, MatchState>
+  findFunction(const FunctionId &ProfFunc,
+               const FunctionMap &OldProfToNewSymbolMap) const;
+  /// Find the function using the profile name. If the function is not found but
+  /// the \p NewIRCallees is provided, try to match the function profile with
+  /// all functions in \p NewIRCallees and return the matched function.
+  ///
+  /// \param ProfFunc The function profile name.
+  /// \param OldProfToNewSymbolMap The map from old profile name to new symbol.
+  /// \param NewIRCallees The new candidate callees in the same scope to match.
+  ///
+  /// \returns The matched function and a match state.
+  std::pair<Function *, MatchState>
+  findOrMatchFunction(const FunctionId &ProfFunc,
----------------
WenleiHe wrote:

similarly `findOrMatchFuncByProfileName`?

https://github.com/llvm/llvm-project/pull/92151


More information about the llvm-commits mailing list