[llvm] [SampleFDO] Read call-graph matching recovered top-level function profile (PR #101053)

via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 8 08:19:43 PDT 2024


================
@@ -413,6 +418,16 @@ class SampleProfileReader {
     if (It != Profiles.end())
       return &It->second;
 
+    if (FuncNameToProfNameMap && !FuncNameToProfNameMap->empty()) {
+      auto R = FuncNameToProfNameMap->find(FunctionId(Fname));
+      if (R != FuncNameToProfNameMap->end()) {
+        Fname = R->second.stringRef();
+        auto It = Profiles.find(FunctionId(Fname));
+        if (It != Profiles.end())
+          return &It->second;
+      }
+    }
----------------
WenleiHe wrote:

Can we avoid coupling between reader and the maps that are specific to profile matching? i.e. can we do this at caller side? 

Ideally, we avoid having `FuncNameToProfNameMap` in reader. 

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


More information about the llvm-commits mailing list