[PATCH] D142250: [BOLT][NFC] Move out ReorderFunctions::printStats

Amir Ayupov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 20 15:44:40 PST 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG86b47f143853: [BOLT][NFC] Move out ReorderFunctions::printStats (authored by Amir).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142250/new/

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.490996.patch
Type: text/x-patch
Size: 1711 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230120/ce13df94/attachment.bin>


More information about the llvm-commits mailing list