[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 12:54:13 PDT 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.
Repository:
rG LLVM Github Monorepo
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));
@@ -3252,6 +3256,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.535493.patch
Type: text/x-patch
Size: 1226 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230628/659d1a3e/attachment.bin>
More information about the llvm-commits
mailing list