[PATCH] D142250: [BOLT][NFC] Move out ReorderFunctions::printStats
Amir Ayupov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 20 13:07:37 PST 2023
Amir created this revision.
Amir added a reviewer: bolt.
Herald added a reviewer: rafauler.
Herald added subscribers: treapster, ayermolo.
Herald added a reviewer: maksfb.
Herald added a project: All.
Amir requested review of this revision.
Herald added subscribers: llvm-commits, yota9.
Herald added a project: LLVM.
Break out stats-printing code from ReorderFunctions::reorder for brevity.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D142250
Files:
bolt/include/bolt/Passes/ReorderFunctions.h
bolt/lib/Passes/ReorderFunctions.cpp
Index: bolt/lib/Passes/ReorderFunctions.cpp
===================================================================
--- bolt/lib/Passes/ReorderFunctions.cpp
+++ bolt/lib/Passes/ReorderFunctions.cpp
@@ -138,6 +138,11 @@
if (opts::ReorderFunctions == RT_NONE)
return;
+ printStats(Clusters, FuncAddr);
+}
+
+void ReorderFunctions::printStats(const std::vector<Cluster> &Clusters,
+ const std::vector<uint64_t> &FuncAddr) {
if (opts::Verbosity == 0) {
#ifndef NDEBUG
if (!DebugFlag || !isCurrentDebugType("hfsort"))
@@ -152,7 +157,7 @@
PrintDetailed |=
(DebugFlag && isCurrentDebugType("hfsort") && opts::Verbosity > 0);
#endif
- TotalSize = 0;
+ uint64_t TotalSize = 0;
uint64_t CurPage = 0;
uint64_t Hotfuncs = 0;
double TotalDistance = 0;
@@ -163,7 +168,7 @@
if (PrintDetailed)
outs() << "BOLT-INFO: Function reordering page layout\n"
<< "BOLT-INFO: ============== page 0 ==============\n";
- for (Cluster &Cluster : Clusters) {
+ for (const Cluster &Cluster : Clusters) {
if (PrintDetailed)
outs() << format(
"BOLT-INFO: -------- density = %.3lf (%u / %u) --------\n",
Index: bolt/include/bolt/Passes/ReorderFunctions.h
===================================================================
--- bolt/include/bolt/Passes/ReorderFunctions.h
+++ bolt/include/bolt/Passes/ReorderFunctions.h
@@ -23,6 +23,9 @@
void reorder(std::vector<Cluster> &&Clusters,
std::map<uint64_t, BinaryFunction> &BFs);
+ void printStats(const std::vector<Cluster> &Clusters,
+ const std::vector<uint64_t> &FuncAddr);
+
public:
enum ReorderType : char {
RT_NONE = 0,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142250.490955.patch
Type: text/x-patch
Size: 1711 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230120/7c85b8e7/attachment.bin>
More information about the llvm-commits
mailing list