[PATCH] D110075: [LTO] [Legacy] Add -debug-pass-manager option to enable pass run/skip trace.
wael yehia via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 20 12:27:55 PDT 2021
w2yehia updated this revision to Diff 373689.
w2yehia added a comment.
Common up the -debug-pass-manager option between LTOCodeGenerator, llvm-lto (which uses LTOCodeGenerator), and llvm-lto2 (which does not use LTOCodeGenerator but uses libLLVMLTO).
Add testcase.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D110075/new/
https://reviews.llvm.org/D110075
Files:
llvm/lib/LTO/LTOCodeGenerator.cpp
llvm/test/tools/llvm-lto/lto-passes.ll
llvm/tools/llvm-lto/llvm-lto.cpp
llvm/tools/llvm-lto2/llvm-lto2.cpp
Index: llvm/tools/llvm-lto2/llvm-lto2.cpp
===================================================================
--- llvm/tools/llvm-lto2/llvm-lto2.cpp
+++ llvm/tools/llvm-lto2/llvm-lto2.cpp
@@ -147,10 +147,6 @@
cl::desc("Run LTO passes using the new pass manager"),
cl::init(LLVM_ENABLE_NEW_PASS_MANAGER), cl::Hidden);
-static cl::opt<bool>
- DebugPassManager("debug-pass-manager", cl::init(false), cl::Hidden,
- cl::desc("Print pass management debugging information"));
-
static cl::opt<std::string>
StatsFile("stats-file", cl::desc("Filename to write statistics to"));
@@ -172,6 +168,10 @@
exit(1);
}
+namespace llvm {
+ extern cl::opt<bool> DebugPassManager;
+}
+
template <typename T> static T check(Expected<T> E, std::string Msg) {
if (E)
return std::move(*E);
Index: llvm/tools/llvm-lto/llvm-lto.cpp
===================================================================
--- llvm/tools/llvm-lto/llvm-lto.cpp
+++ llvm/tools/llvm-lto/llvm-lto.cpp
@@ -259,10 +259,9 @@
"use-new-pm", cl::desc("Run LTO passes using the new pass manager"),
cl::init(LLVM_ENABLE_NEW_PASS_MANAGER), cl::Hidden, cl::cat(LTOCategory));
-static cl::opt<bool>
- DebugPassManager("debug-pass-manager", cl::init(false), cl::Hidden,
- cl::desc("Print pass management debugging information"),
- cl::cat(LTOCategory));
+namespace llvm {
+ extern cl::opt<bool> DebugPassManager;
+}
namespace {
Index: llvm/test/tools/llvm-lto/lto-passes.ll
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-lto/lto-passes.ll
@@ -0,0 +1,12 @@
+; Test that -debug-pass-manager works in LTOCodeGenerator. The actual list of
+; passes that is run during LTO is tested in:
+; llvm/test/Other/new-pm-lto-defaults.ll
+;
+; RUN: llvm-as < %s > %t.bc
+; RUN: llvm-lto %t.bc -O0 --debug-pass-manager 2>&1 | FileCheck %s
+; CHECK: Running pass: WholeProgramDevirtPass
+
+define i32 @main() {
+entry:
+ ret i32 42
+}
Index: llvm/lib/LTO/LTOCodeGenerator.cpp
===================================================================
--- llvm/lib/LTO/LTOCodeGenerator.cpp
+++ llvm/lib/LTO/LTOCodeGenerator.cpp
@@ -117,6 +117,9 @@
"lto-stats-file",
cl::desc("Save statistics to the specified file"),
cl::Hidden);
+cl::opt<bool>
+ DebugPassManager("debug-pass-manager", cl::init(false), cl::Hidden,
+ cl::desc("Print pass management debugging information"));
}
LTOCodeGenerator::LTOCodeGenerator(LLVMContext &Context)
@@ -130,6 +133,7 @@
Config.PreCodeGenPassesHook = [](legacy::PassManager &PM) {
PM.add(createObjCARCContractPass());
};
+ Config.DebugPassManager = DebugPassManager;
}
LTOCodeGenerator::~LTOCodeGenerator() {}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110075.373689.patch
Type: text/x-patch
Size: 2814 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210920/5f7f9e55/attachment.bin>
More information about the llvm-commits
mailing list