[PATCH] D153996: [BOLT][NFC] Print functions after attaching profile (-print-profile)

Amir Ayupov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 28 17:51:42 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rGfd49cc87d002: [BOLT][NFC] Print functions after attaching profile (-print-profile) (authored by Amir).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153996

Files:
  bolt/lib/Rewrite/RewriteInstance.cpp


Index: bolt/lib/Rewrite/RewriteInstance.cpp
===================================================================
--- bolt/lib/Rewrite/RewriteInstance.cpp
+++ bolt/lib/Rewrite/RewriteInstance.cpp
@@ -172,6 +172,10 @@
                        cl::desc("print functions after each stage"), cl::Hidden,
                        cl::cat(BoltCategory));
 
+cl::opt<bool> PrintProfile("print-profile",
+                           cl::desc("print functions after attaching profile"),
+                           cl::Hidden, cl::cat(BoltCategory));
+
 cl::opt<bool> PrintCFG("print-cfg",
                        cl::desc("print functions after CFG construction"),
                        cl::Hidden, cl::cat(BoltCategory));
@@ -3260,6 +3264,16 @@
   if (Error E = ProfileReader->readProfile(*BC.get()))
     report_error("cannot read profile", std::move(E));
 
+  if (opts::PrintProfile || opts::PrintAll) {
+    for (auto &BFI : BC->getBinaryFunctions()) {
+      BinaryFunction &Function = BFI.second;
+      if (Function.empty())
+        continue;
+
+      Function.print(outs(), "after attaching profile");
+    }
+  }
+
   if (!opts::SaveProfile.empty()) {
     YAMLProfileWriter PW(opts::SaveProfile);
     PW.writeProfile(*this);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153996.535587.patch
Type: text/x-patch
Size: 1226 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230629/a3a16a70/attachment.bin>


More information about the llvm-commits mailing list