llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-bolt Author: shaw young (shawbyoung) <details> <summary>Changes</summary> Using the hashes of binary and profiled functions to recover functions with changed names. Test Plan: tbd --- Full diff: https://github.com/llvm/llvm-project/pull/95821.diff 1 Files Affected: - (modified) bolt/lib/Profile/YAMLProfileReader.cpp (+17) ``````````diff diff --git a/bolt/lib/Profile/YAMLProfileReader.cpp b/bolt/lib/Profile/YAMLProfileReader.cpp index f25f59201f1cd..f0fcb1c130002 100644 --- a/bolt/lib/Profile/YAMLProfileReader.cpp +++ b/bolt/lib/Profile/YAMLProfileReader.cpp @@ -415,6 +415,23 @@ Error YAMLProfileReader::readProfile(BinaryContext &BC) { if (!YamlBF.Used && BF && !ProfiledFunctions.count(BF)) matchProfileToFunction(YamlBF, *BF); + // Uses the strict hash of profiled and binary functions to match functions + // that are not matched by name or common name. + std::unordered_map<size_t, BinaryFunction*> StrictBinaryFunctionHashes; + StrictBinaryFunctionHashes.reserve(BC.getBinaryFunctions().size()); + + for (auto& [_, BF] : BC.getBinaryFunctions()) { + StrictBinaryFunctionHashes[BF.getHash()] = &BF; + } + + for (auto YamlBF : YamlBP.Functions) { + auto It = StrictBinaryFunctionHashes.find(YamlBF.Hash); + if (It != StrictBinaryFunctionHashes.end() && !ProfiledFunctions.count(It->second)) { + auto *BF = It->second; + matchProfileToFunction(YamlBF, *BF); + } + } + for (yaml::bolt::BinaryFunctionProfile &YamlBF : YamlBP.Functions) if (!YamlBF.Used && opts::Verbosity >= 1) errs() << "BOLT-WARNING: profile ignored for function " << YamlBF.Name `````````` </details> https://github.com/llvm/llvm-project/pull/95821 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits