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

Lei Wang via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 17 16:28:25 PDT 2024


================
@@ -279,36 +345,42 @@ void SampleProfileMatcher::matchNonCallsiteLocs(
 // The output mapping: [2->3, 3->4, 5->7, 6->8, 7->9].
 void SampleProfileMatcher::runStaleProfileMatching(
     const Function &F, const AnchorMap &IRAnchors,
-    const AnchorMap &ProfileAnchors, LocToLocMap &IRToProfileLocationMap) {
+    const AnchorMap &ProfileAnchors, LocToLocMap &IRToProfileLocationMap,
+    bool RunCFGMatching, bool RunCGMatching) {
+  if (!RunCFGMatching && !RunCGMatching)
+    return;
   LLVM_DEBUG(dbgs() << "Run stale profile matching for " << F.getName()
                     << "\n");
   assert(IRToProfileLocationMap.empty() &&
          "Run stale profile matching only once per function");
 
   AnchorList FilteredProfileAnchorList;
-  for (const auto &I : ProfileAnchors)
-    FilteredProfileAnchorList.emplace_back(I);
-
   AnchorList FilteredIRAnchorsList;
-  // Filter the non-callsite from IRAnchors.
-  for (const auto &I : IRAnchors) {
-    if (I.second.stringRef().empty())
-      continue;
-    FilteredIRAnchorsList.emplace_back(I);
-  }
+  getFilteredAnchorList(IRAnchors, ProfileAnchors, FilteredIRAnchorsList,
----------------
wlei-llvm wrote:

done in https://github.com/llvm/llvm-project/pull/95830. 

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


More information about the llvm-commits mailing list