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

Lei Wang via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 14 17:58:10 PDT 2024


================
@@ -72,34 +99,54 @@ class SampleProfileMatcher {
   uint64_t MismatchedCallsiteSamples = 0;
   uint64_t RecoveredCallsiteSamples = 0;
 
+  // Profile call-graph matching statstics:
+  uint64_t NumRecoveredUnusedSamples = 0;
+  uint64_t NumRecoveredUnusedFunc = 0;
+
   // A dummy name for unknown indirect callee, used to differentiate from a
   // non-call instruction that also has an empty callee name.
   static constexpr const char *UnknownIndirectCallee =
       "unknown.indirect.callee";
 
 public:
-  SampleProfileMatcher(Module &M, SampleProfileReader &Reader,
-                       const PseudoProbeManager *ProbeManager,
-                       ThinOrFullLTOPhase LTOPhase)
-      : M(M), Reader(Reader), ProbeManager(ProbeManager), LTOPhase(LTOPhase){};
-  void runOnModule();
+  SampleProfileMatcher(
+      Module &M, SampleProfileReader &Reader,
+      const PseudoProbeManager *ProbeManager, ThinOrFullLTOPhase LTOPhase,
+      HashKeyMap<std::unordered_map, FunctionId, Function *> &SymMap,
+      std::shared_ptr<ProfileSymbolList> PSL)
+      : M(M), Reader(Reader), ProbeManager(ProbeManager), LTOPhase(LTOPhase),
+        SymbolMap(&SymMap), PSL(PSL) {};
+  void runOnModule(std::vector<Function *> &OrderedFuncList);
----------------
wlei-llvm wrote:

Good point, done.(that needs some refactoring to reuse the code from SampleLoader)

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


More information about the llvm-commits mailing list