[llvm-branch-commits] [llvm] [BOLT] Add perf2bolt pre-aggregated profile output (PR #199465)
Amir Ayupov via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon May 25 14:27:21 PDT 2026
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/199465
>From 51e882bb54c51c82eec8e65e36c6aaa0be9e40d0 Mon Sep 17 00:00:00 2001
From: Amir Ayupov <aaupov at fb.com>
Date: Mon, 25 May 2026 14:27:11 -0700
Subject: [PATCH] use operator<<
Created using spr 1.3.4
---
bolt/include/bolt/Profile/DataAggregator.h | 16 +---------------
bolt/lib/Profile/DataAggregator.cpp | 7 ++-----
2 files changed, 3 insertions(+), 20 deletions(-)
diff --git a/bolt/include/bolt/Profile/DataAggregator.h b/bolt/include/bolt/Profile/DataAggregator.h
index dca24b9c57983..ac4abd7ab9745 100644
--- a/bolt/include/bolt/Profile/DataAggregator.h
+++ b/bolt/include/bolt/Profile/DataAggregator.h
@@ -655,21 +655,7 @@ inline raw_ostream &operator<<(raw_ostream &OS,
inline raw_ostream &operator<<(raw_ostream &OS,
const DataAggregator::Trace &T) {
- switch (T.Branch) {
- case DataAggregator::Trace::FT_ONLY:
- break;
- case DataAggregator::Trace::FT_EXTERNAL_ORIGIN:
- OS << "X:0 -> ";
- break;
- case DataAggregator::Trace::FT_EXTERNAL_RETURN:
- OS << "X:R -> ";
- break;
- default:
- OS << Twine::utohexstr(T.Branch) << " -> ";
- }
- OS << Twine::utohexstr(T.From);
- if (T.To != DataAggregator::Trace::BR_ONLY)
- OS << " ... " << Twine::utohexstr(T.To);
+ OS << formatv("T {0:x-} {1:x-} {2:x-}", T.Branch, T.From, T.To);
return OS;
}
diff --git a/bolt/lib/Profile/DataAggregator.cpp b/bolt/lib/Profile/DataAggregator.cpp
index b5017ccdcdb7f..8d19c9a9aa77a 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -2338,11 +2338,8 @@ DataAggregator::writePreAggregatedFile(StringRef OutputFilename) const {
if (EC)
return EC;
- for (const auto &[Trace, Info] : Traces) {
- const bool IsReturn = Returns.find(Trace.Branch) != Returns.end();
- OS << formatv("{0} {1:x-} {2:x-} {3:x-} {4}\n", IsReturn ? 'R' : 'T',
- Trace.Branch, Trace.From, Trace.To, Info.TakenCount);
- }
+ for (const auto &[Trace, Info] : Traces)
+ OS << Trace << " " << Info.TakenCount << '\n';
OS << formatv("E {0:$[,]}\n", EventNames.keys());
for (const auto &[PC, Count] : BasicSamples)
OS << formatv("S {0:x-} {1}\n", PC, Count);
More information about the llvm-branch-commits
mailing list