[llvm-branch-commits] [llvm] [BOLT][NFC] Refactor function matching (PR #97502)

Shaw Young via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jul 5 12:55:24 PDT 2024


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

>From c6212e4b26b0f0d8abde323fa5fc04ecc6dd34fd Mon Sep 17 00:00:00 2001
From: shawbyoung <shawbyoung at gmail.com>
Date: Wed, 3 Jul 2024 09:45:46 -0700
Subject: [PATCH 1/3] Changed profileMatches comment

Created using spr 1.3.4
---
 bolt/include/bolt/Profile/YAMLProfileReader.h | 2 +-
 bolt/lib/Profile/YAMLProfileReader.cpp        | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/bolt/include/bolt/Profile/YAMLProfileReader.h b/bolt/include/bolt/Profile/YAMLProfileReader.h
index a5bd3544bd9992..627cebf5d9453a 100644
--- a/bolt/include/bolt/Profile/YAMLProfileReader.h
+++ b/bolt/include/bolt/Profile/YAMLProfileReader.h
@@ -73,7 +73,7 @@ class YAMLProfileReader : public ProfileReaderBase {
   bool parseFunctionProfile(BinaryFunction &Function,
                             const yaml::bolt::BinaryFunctionProfile &YamlBF);
 
-  /// Returns block cnt equality if IgnoreHash is true, otherwise, hash equality
+  /// Checks if a function profile matches a binary function.
   bool profileMatches(const yaml::bolt::BinaryFunctionProfile &Profile,
                       BinaryFunction &BF);
 
diff --git a/bolt/lib/Profile/YAMLProfileReader.cpp b/bolt/lib/Profile/YAMLProfileReader.cpp
index e8ce187367899d..91628d950e9f4a 100644
--- a/bolt/lib/Profile/YAMLProfileReader.cpp
+++ b/bolt/lib/Profile/YAMLProfileReader.cpp
@@ -333,6 +333,7 @@ Error YAMLProfileReader::preprocessProfile(BinaryContext &BC) {
 
   return Error::success();
 }
+
 bool YAMLProfileReader::profileMatches(
     const yaml::bolt::BinaryFunctionProfile &Profile, BinaryFunction &BF) {
   if (opts::IgnoreHash)

>From 1f48f09228b54e410910c2186cf0c3a73400bfd3 Mon Sep 17 00:00:00 2001
From: shawbyoung <shawbyoung at gmail.com>
Date: Wed, 3 Jul 2024 10:26:27 -0700
Subject: [PATCH 2/3] Changing profileMatches BF param to const

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 627cebf5d9453a..fe9f349de278d4 100644
--- a/bolt/include/bolt/Profile/YAMLProfileReader.h
+++ b/bolt/include/bolt/Profile/YAMLProfileReader.h
@@ -75,7 +75,7 @@ class YAMLProfileReader : public ProfileReaderBase {
 
   /// Checks if a function profile matches a binary function.
   bool profileMatches(const yaml::bolt::BinaryFunctionProfile &Profile,
-                      BinaryFunction &BF);
+                      const BinaryFunction &BF);
 
   /// Infer function profile from stale data (collected on older binaries).
   bool inferStaleProfile(BinaryFunction &Function,

>From 2b0a7b0870e722900b0538c8fb8d5e68329d0c73 Mon Sep 17 00:00:00 2001
From: shawbyoung <shawbyoung at gmail.com>
Date: Fri, 5 Jul 2024 12:07:44 -0700
Subject: [PATCH 3/3] spr amend

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 930bd37e14e138..54e6fa21c85d40 100644
--- a/bolt/lib/Profile/YAMLProfileReader.cpp
+++ b/bolt/lib/Profile/YAMLProfileReader.cpp
@@ -335,7 +335,7 @@ Error YAMLProfileReader::preprocessProfile(BinaryContext &BC) {
 }
 
 bool YAMLProfileReader::profileMatches(
-    const yaml::bolt::BinaryFunctionProfile &Profile, BinaryFunction &BF) {
+    const yaml::bolt::BinaryFunctionProfile &Profile, const BinaryFunction &BF) {
   if (opts::IgnoreHash)
     return Profile.NumBasicBlocks == BF.size();
   return Profile.Hash == static_cast<uint64_t>(BF.getHash());



More information about the llvm-branch-commits mailing list