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

via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 4 00:49:48 PDT 2024


================
@@ -58,6 +58,34 @@ class SampleProfileMatcher {
   StringMap<std::unordered_map<LineLocation, MatchState, LineLocationHash>>
       FuncCallsiteMatchStates;
 
+  struct FuncProfNameMapHash {
+    uint64_t
+    operator()(const std::pair<const Function *, FunctionId> &P) const {
+      return hash_combine(P.first, P.second);
+    }
+  };
+  // A map from a pair of function and profile name to a boolean value
+  // indicating whether they are matched. This is used as a cache for the
+  // matching result.
+  std::unordered_map<std::pair<const Function *, FunctionId>, bool,
+                     FuncProfNameMapHash>
+      FunctionProfileNameMap;
----------------
WenleiHe wrote:

nit: I was suggesting 

`FunctionProfileNameMap` -> `FuncToProfileNameMap`
`OldProfToNewSymbolMap` -> `ProfileNameToFuncMap`

because symmetric naming helps readability. I saw you changed the other one, but not this one. 

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


More information about the llvm-commits mailing list