[llvm-branch-commits] [llvm] [BOLT] Hash-based function matching (PR #95821)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jun 21 13:21:59 PDT 2024


================
@@ -374,15 +393,34 @@ Error YAMLProfileReader::readProfile(BinaryContext &BC) {
     // the profile.
     Function.setExecutionCount(BinaryFunction::COUNT_NO_PROFILE);
 
-    // Recompute hash once per function.
-    if (!opts::IgnoreHash)
-      Function.computeHash(YamlBP.Header.IsDFSOrder,
-                           YamlBP.Header.HashFunction);
-
-    if (profileMatches(YamlBF, Function))
+    if (profileMatches(YamlBF, Function)) {
       matchProfileToFunction(YamlBF, Function);
+      ++MatchedWithExactName;
+    }
   }
 
+  // Uses the strict hash of profiled and binary functions to match functions
+  // that are not matched by name or common name.
+  if (opts::MatchingFunctionsWithHash) {
----------------
WenleiHe wrote:

What is captured in strict hash?

For reference, function hash for compiler PGO isn't very strict, and it's not strong enough for small functions. So we use comprehensive graph matching in addition to hash matching to recover renamed function/profile pair. Change in https://github.com/llvm/llvm-project/pull/95135 cc @wlei-llvm  

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


More information about the llvm-branch-commits mailing list