[llvm-branch-commits] [llvm] [BOLT] Build heatmap with pre-aggregated data (PR #138798)
Amir Ayupov via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon May 12 17:59:15 PDT 2025
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/138798
>From f6b275f682c598d5c026efcbd348c6e8a35c759b Mon Sep 17 00:00:00 2001
From: Amir Ayupov <aaupov at fb.com>
Date: Tue, 6 May 2025 20:09:58 -0700
Subject: [PATCH 1/2] keep parsing build-id
Created using spr 1.3.4
---
bolt/lib/Profile/DataAggregator.cpp | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/bolt/lib/Profile/DataAggregator.cpp b/bolt/lib/Profile/DataAggregator.cpp
index c5b9696dc79d0..a5ac87ee781b2 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -450,6 +450,14 @@ int DataAggregator::prepareToParse(StringRef Name, PerfProcessInfo &Process,
Error DataAggregator::preprocessProfile(BinaryContext &BC) {
this->BC = &BC;
+ if (std::optional<StringRef> FileBuildID = BC.getFileBuildID()) {
+ outs() << "BOLT-INFO: binary build-id is: " << *FileBuildID << "\n";
+ processFileBuildID(*FileBuildID);
+ } else {
+ errs() << "BOLT-WARNING: build-id will not be checked because we could "
+ "not read one from input binary\n";
+ }
+
auto ErrorCallback = [](int ReturnCode, StringRef ErrBuf) {
errs() << "PERF-ERROR: return code " << ReturnCode << "\n" << ErrBuf;
exit(1);
@@ -468,14 +476,6 @@ Error DataAggregator::preprocessProfile(BinaryContext &BC) {
goto heatmap;
}
- if (std::optional<StringRef> FileBuildID = BC.getFileBuildID()) {
- outs() << "BOLT-INFO: binary build-id is: " << *FileBuildID << "\n";
- processFileBuildID(*FileBuildID);
- } else {
- errs() << "BOLT-WARNING: build-id will not be checked because we could "
- "not read one from input binary\n";
- }
-
if (BC.IsLinuxKernel) {
// Current MMap parsing logic does not work with linux kernel.
// MMap entries for linux kernel uses PERF_RECORD_MMAP
>From 47f76b8dff0f639cac4b205de86224bfa50aa430 Mon Sep 17 00:00:00 2001
From: Amir Ayupov <aaupov at fb.com>
Date: Fri, 9 May 2025 15:01:28 -0700
Subject: [PATCH 2/2] simplify preprocessProfile
Created using spr 1.3.4
---
bolt/lib/Profile/DataAggregator.cpp | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/bolt/lib/Profile/DataAggregator.cpp b/bolt/lib/Profile/DataAggregator.cpp
index c5b9696dc79d0..a259292bd0a29 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -518,13 +518,12 @@ Error DataAggregator::preprocessProfile(BinaryContext &BC) {
deleteTempFiles();
heatmap:
- if (opts::HeatmapMode) {
- if (std::error_code EC = printLBRHeatMap())
- return errorCodeToError(EC);
- exit(0);
- }
+ if (!opts::HeatmapMode)
+ return Error::success();
- return Error::success();
+ if (std::error_code EC = printLBRHeatMap())
+ return errorCodeToError(EC);
+ exit(0);
}
Error DataAggregator::readProfile(BinaryContext &BC) {
More information about the llvm-branch-commits
mailing list