[llvm-branch-commits] [llvm] [BOLT] Match functions with pseudo probes (PR #100446)

Shaw Young via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jul 24 11:50:04 PDT 2024


https://github.com/shawbyoung updated https://github.com/llvm/llvm-project/pull/100446

>From 56b45b104a2ab2dbc4ab8e9643c90092894b579e Mon Sep 17 00:00:00 2001
From: shawbyoung <shawbyoung at gmail.com>
Date: Wed, 24 Jul 2024 11:29:22 -0700
Subject: [PATCH 1/3] Comment

Created using spr 1.3.4
---
 bolt/include/bolt/Profile/YAMLProfileReader.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bolt/include/bolt/Profile/YAMLProfileReader.h b/bolt/include/bolt/Profile/YAMLProfileReader.h
index 6c00f82302fb9..bc09751fcae75 100644
--- a/bolt/include/bolt/Profile/YAMLProfileReader.h
+++ b/bolt/include/bolt/Profile/YAMLProfileReader.h
@@ -108,7 +108,7 @@ class YAMLProfileReader : public ProfileReaderBase {
   std::vector<BinaryFunction *> YamlProfileToFunction;
 
   using FunctionSet = std::unordered_set<const BinaryFunction *>;
-  /// To keep track of functions that have a matched profile before the profilez
+  /// To keep track of functions that have a matched profile before the profile
   /// is attributed.
   FunctionSet ProfiledFunctions;
 

>From b851ca65c2bf2a9569315d62722b60a04c8102ee Mon Sep 17 00:00:00 2001
From: shawbyoung <shawbyoung at gmail.com>
Date: Wed, 24 Jul 2024 11:39:48 -0700
Subject: [PATCH 2/3] Was accessing wrong YamlBF Hash, fixed

Created using spr 1.3.4
---
 bolt/lib/Profile/YAMLProfileReader.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bolt/lib/Profile/YAMLProfileReader.cpp b/bolt/lib/Profile/YAMLProfileReader.cpp
index 68af95a1cd043..f5ac0b8e2c56a 100644
--- a/bolt/lib/Profile/YAMLProfileReader.cpp
+++ b/bolt/lib/Profile/YAMLProfileReader.cpp
@@ -614,7 +614,7 @@ size_t YAMLProfileReader::matchWithPseudoProbes(BinaryContext &BC) {
 
   uint64_t MatchedWithPseudoProbes = 0;
   for (yaml::bolt::BinaryFunctionProfile &YamlBF : YamlBP.Functions) {
-    auto It = PseudoProbeDescHashToBF.find(YamlBF.Hash);
+    auto It = PseudoProbeDescHashToBF.find(YamlBF.PseudoProbeDescHash);
     if (It == PseudoProbeDescHashToBF.end())
       continue;
     BinaryFunction *BF = It->second;

>From 39ba7175c9224c3584db7f5f8ca8fbed14da41e5 Mon Sep 17 00:00:00 2001
From: shawbyoung <shawbyoung at gmail.com>
Date: Wed, 24 Jul 2024 11:49:54 -0700
Subject: [PATCH 3/3] Changed ordering of matching

Created using spr 1.3.4
---
 bolt/lib/Profile/YAMLProfileReader.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/bolt/lib/Profile/YAMLProfileReader.cpp b/bolt/lib/Profile/YAMLProfileReader.cpp
index f5ac0b8e2c56a..75ec4465856a1 100644
--- a/bolt/lib/Profile/YAMLProfileReader.cpp
+++ b/bolt/lib/Profile/YAMLProfileReader.cpp
@@ -770,8 +770,8 @@ Error YAMLProfileReader::readProfile(BinaryContext &BC) {
   const size_t MatchedWithHash = matchWithHash(BC);
   const size_t MatchedWithLTOCommonName = matchWithLTOCommonName();
   const size_t MatchedWithCallGraph = matchWithCallGraph(BC);
-  const size_t MatchedWithNameSimilarity = matchWithNameSimilarity(BC);
   const size_t MatchedWithPseudoProbes = matchWithPseudoProbes(BC);
+  const size_t MatchedWithNameSimilarity = matchWithNameSimilarity(BC);
 
   for (auto [YamlBF, BF] : llvm::zip_equal(YamlBP.Functions, ProfileBFs))
     if (!YamlBF.Used && BF && !ProfiledFunctions.count(BF))
@@ -792,10 +792,10 @@ Error YAMLProfileReader::readProfile(BinaryContext &BC) {
            << " functions with matching LTO common names\n";
     outs() << "BOLT-INFO: matched " << MatchedWithCallGraph
            << " functions with call graph\n";
-    outs() << "BOLT-INFO: matched " << MatchedWithNameSimilarity
-           << " functions with similar names\n";
     outs() << "BOLT-INFO: matched " << MatchedWithPseudoProbes
            << " functions with pseudo probes\n";
+    outs() << "BOLT-INFO: matched " << MatchedWithNameSimilarity
+           << " functions with similar names\n";
   }
 
   // Set for parseFunctionProfile().



More information about the llvm-branch-commits mailing list