diff --git a/bolt/include/bolt/Passes/ReorderFunctions.h b/bolt/include/bolt/Passes/ReorderFunctions.h --- a/bolt/include/bolt/Passes/ReorderFunctions.h +++ b/bolt/include/bolt/Passes/ReorderFunctions.h @@ -23,6 +23,9 @@ void reorder(std::vector &&Clusters, std::map &BFs); + void printStats(const std::vector &Clusters, + const std::vector &FuncAddr); + public: enum ReorderType : char { RT_NONE = 0, diff --git a/bolt/lib/Passes/ReorderFunctions.cpp b/bolt/lib/Passes/ReorderFunctions.cpp --- a/bolt/lib/Passes/ReorderFunctions.cpp +++ b/bolt/lib/Passes/ReorderFunctions.cpp @@ -138,6 +138,11 @@ if (opts::ReorderFunctions == RT_NONE) return; + printStats(Clusters, FuncAddr); +} + +void ReorderFunctions::printStats(const std::vector &Clusters, + const std::vector &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",