[llvm-branch-commits] [llvm] [BOLT] Hash-based function matching (PR #95821)
shaw young via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Jun 17 15:39:49 PDT 2024
https://github.com/shawbyoung updated https://github.com/llvm/llvm-project/pull/95821
>From 92212c96ea169d26ac10bf8d750539bc5dd72c49 Mon Sep 17 00:00:00 2001
From: shawbyoung <shawbyoung at gmail.com>
Date: Mon, 17 Jun 2024 15:39:02 -0700
Subject: [PATCH 1/2] spr amend
Created using spr 1.3.4
---
bolt/lib/Profile/YAMLProfileReader.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/bolt/lib/Profile/YAMLProfileReader.cpp b/bolt/lib/Profile/YAMLProfileReader.cpp
index f0fcb1c130002..2bca83c9d11ec 100644
--- a/bolt/lib/Profile/YAMLProfileReader.cpp
+++ b/bolt/lib/Profile/YAMLProfileReader.cpp
@@ -421,6 +421,8 @@ Error YAMLProfileReader::readProfile(BinaryContext &BC) {
StrictBinaryFunctionHashes.reserve(BC.getBinaryFunctions().size());
for (auto& [_, BF] : BC.getBinaryFunctions()) {
+ if (!ProfiledFunctions.count(&BF))
+ continue;
StrictBinaryFunctionHashes[BF.getHash()] = &BF;
}
>From 2497922ccc46e3189870563b1fe819b67172778d Mon Sep 17 00:00:00 2001
From: shawbyoung <shawbyoung at gmail.com>
Date: Mon, 17 Jun 2024 15:39:39 -0700
Subject: [PATCH 2/2] spr amend
Created using spr 1.3.4
---
bolt/lib/Profile/YAMLProfileReader.cpp | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/bolt/lib/Profile/YAMLProfileReader.cpp b/bolt/lib/Profile/YAMLProfileReader.cpp
index 2bca83c9d11ec..56474a67307ed 100644
--- a/bolt/lib/Profile/YAMLProfileReader.cpp
+++ b/bolt/lib/Profile/YAMLProfileReader.cpp
@@ -417,10 +417,10 @@ Error YAMLProfileReader::readProfile(BinaryContext &BC) {
// 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;
+ std::unordered_map<size_t, BinaryFunction *> StrictBinaryFunctionHashes;
StrictBinaryFunctionHashes.reserve(BC.getBinaryFunctions().size());
- for (auto& [_, BF] : BC.getBinaryFunctions()) {
+ for (auto &[_, BF] : BC.getBinaryFunctions()) {
if (!ProfiledFunctions.count(&BF))
continue;
StrictBinaryFunctionHashes[BF.getHash()] = &BF;
@@ -428,7 +428,8 @@ Error YAMLProfileReader::readProfile(BinaryContext &BC) {
for (auto YamlBF : YamlBP.Functions) {
auto It = StrictBinaryFunctionHashes.find(YamlBF.Hash);
- if (It != StrictBinaryFunctionHashes.end() && !ProfiledFunctions.count(It->second)) {
+ if (It != StrictBinaryFunctionHashes.end() &&
+ !ProfiledFunctions.count(It->second)) {
auto *BF = It->second;
matchProfileToFunction(YamlBF, *BF);
}
More information about the llvm-branch-commits
mailing list