[llvm] [BOLT] Hash-based function matching (PR #96572)
Maksim Panchenko via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 28 12:02:07 PDT 2024
================
@@ -374,15 +394,35 @@ 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. Collisions are possible in the
+ // unlikely case where multiple functions share the same exact hash.
----------------
maksfb wrote:
We should say that it will match the first function without profile that has the same hash. It's not that uncommon to have identical functions in the binary. That's why linkers and BOLT implement ICF optimization.
https://github.com/llvm/llvm-project/pull/96572
More information about the llvm-commits
mailing list