[llvm] [CSSPGO] Compute and report profile matching recovered callsites and samples (PR #79090)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 31 22:52:01 PST 2024


================
@@ -444,15 +444,34 @@ class SampleProfileMatcher {
   // the profile.
   StringMap<LocToLocMap> FuncMappings;
 
-  // Profile mismatching statstics.
+  // Match state for an anchor/callsite.
+  enum class MatchState {
+    Matched = 0,
+    Mismatched = 0x1,
+    Recovered = 0x1,
+  };
+
+  // For each function, store every callsite state into a map, of which each
+  // entry is a pair of callsite location and MatchState. This is used for
+  // profile stalness computation and report.
+  StringMap<std::unordered_map<LineLocation, MatchState, LineLocationHash>>
+      FuncCallsiteMatchStates;
+
+  /// Profile mismatch statstics:
+  uint64_t TotalProfiledFunc = 0;
+  // Num of function whose checksum is mismatched.
+  uint64_t NumMismatchedFunc = 0;
----------------
WenleiHe wrote:

Should we categorize them as `NumStaleProfileFunc` (has profile with same name but CFG checksum mismatches) and `NumNoProfileFunc` (no profile for the function at all, but we may recover a profile after we handle function renaming)?

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


More information about the llvm-commits mailing list