[llvm-branch-commits] [BOLT][NFC] Move out PrintProgramStats from Profile into Rewrite (PR #93075)

2024-05-22 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov created 
https://github.com/llvm/llvm-project/pull/93075

Eliminate the dependence of Profile on Passes.

Test Plan: NFC



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [BOLT][NFC] Move out PrintProgramStats from Profile into Rewrite (PR #93075)

2024-05-22 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-bolt

Author: Amir Ayupov (aaupov)


Changes

Eliminate the dependence of Profile on Passes.

Test Plan: NFC


---
Full diff: https://github.com/llvm/llvm-project/pull/93075.diff


3 Files Affected:

- (modified) bolt/lib/Profile/CMakeLists.txt (-1) 
- (modified) bolt/lib/Profile/DataAggregator.cpp (-2) 
- (modified) bolt/lib/Rewrite/RewriteInstance.cpp (+5-1) 


``diff
diff --git a/bolt/lib/Profile/CMakeLists.txt b/bolt/lib/Profile/CMakeLists.txt
index 045ac47edb950..ca8b9c34e63b1 100644
--- a/bolt/lib/Profile/CMakeLists.txt
+++ b/bolt/lib/Profile/CMakeLists.txt
@@ -17,6 +17,5 @@ add_llvm_library(LLVMBOLTProfile
 target_link_libraries(LLVMBOLTProfile
   PRIVATE
   LLVMBOLTCore
-  LLVMBOLTPasses
   LLVMBOLTUtils
   )
diff --git a/bolt/lib/Profile/DataAggregator.cpp 
b/bolt/lib/Profile/DataAggregator.cpp
index c0fd69b98c82d..a9252ea04453d 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -613,8 +613,6 @@ Error DataAggregator::readProfile(BinaryContext &BC) {
 if (std::error_code EC = writeBATYAML(BC, opts::SaveProfile))
   report_error("cannot create output data file", EC);
 }
-PrintProgramStats PPS(BAT);
-BC.logBOLTErrorsAndQuitOnFatal(PPS.runOnFunctions(BC));
   }
 
   return Error::success();
diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp 
b/bolt/lib/Rewrite/RewriteInstance.cpp
index 9cc4c8c8c4faf..7024437110314 100644
--- a/bolt/lib/Rewrite/RewriteInstance.cpp
+++ b/bolt/lib/Rewrite/RewriteInstance.cpp
@@ -17,6 +17,7 @@
 #include "bolt/Core/MCPlusBuilder.h"
 #include "bolt/Core/ParallelUtilities.h"
 #include "bolt/Core/Relocation.h"
+#include "bolt/Passes/BinaryPasses.h"
 #include "bolt/Passes/CacheMetrics.h"
 #include "bolt/Passes/ReorderFunctions.h"
 #include "bolt/Profile/BoltAddressTranslation.h"
@@ -3285,8 +3286,11 @@ void RewriteInstance::processProfileData() {
   // Release memory used by profile reader.
   ProfileReader.reset();
 
-  if (opts::AggregateOnly)
+  if (opts::AggregateOnly) {
+PrintProgramStats PPS(&*BAT);
+BC->logBOLTErrorsAndQuitOnFatal(PPS.runOnFunctions(*BC));
 exit(0);
+  }
 }
 
 void RewriteInstance::disassembleFunctions() {

``




https://github.com/llvm/llvm-project/pull/93075
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [BOLT][NFC] Move out PrintProgramStats from Profile into Rewrite (PR #93075)

2024-05-22 Thread Rafael Auler via llvm-branch-commits

https://github.com/rafaelauler approved this pull request.

LGTM thanks

https://github.com/llvm/llvm-project/pull/93075
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits