[PATCH] D97810: [opt] Error if -debug-pass is specified alongside the new PM
Arthur Eubanks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 2 14:50:37 PST 2021
aeubanks created this revision.
Herald added subscribers: dexonsmith, hiraditya.
aeubanks requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D97810
Files:
llvm/include/llvm/IR/LegacyPassManager.h
llvm/lib/IR/LegacyPassManager.cpp
llvm/test/Other/debug-pass-npm.ll
llvm/tools/opt/opt.cpp
Index: llvm/tools/opt/opt.cpp
===================================================================
--- llvm/tools/opt/opt.cpp
+++ llvm/tools/opt/opt.cpp
@@ -775,6 +775,11 @@
"full list of passes, see the '--print-passes' flag.\n";
return 1;
}
+ if (legacy::debugPassSpecified()) {
+ errs() << "-debug-pass does not work with the new PM, either use "
+ "-debug-pass-manager, or use the legacy PM\n";
+ return 1;
+ }
if (PassPipeline.getNumOccurrences() > 0 && PassList.size() > 0) {
errs()
<< "Cannot specify passes via both -foo-pass and --passes=foo-pass\n";
Index: llvm/test/Other/debug-pass-npm.ll
===================================================================
--- /dev/null
+++ llvm/test/Other/debug-pass-npm.ll
@@ -0,0 +1,4 @@
+; RUN: opt -enable-new-pm=0 -O1 %s -debug-pass=Structure
+; RUN: not opt -enable-new-pm=1 -O1 %s -debug-pass=Structure 2>&1 | FileCheck %s
+
+; CHECK: does not work
Index: llvm/lib/IR/LegacyPassManager.cpp
===================================================================
--- llvm/lib/IR/LegacyPassManager.cpp
+++ llvm/lib/IR/LegacyPassManager.cpp
@@ -242,6 +242,8 @@
namespace llvm {
namespace legacy {
+bool debugPassSpecified() { return PassDebugging != Disabled; }
+
//===----------------------------------------------------------------------===//
// FunctionPassManagerImpl
//
Index: llvm/include/llvm/IR/LegacyPassManager.h
===================================================================
--- llvm/include/llvm/IR/LegacyPassManager.h
+++ llvm/include/llvm/IR/LegacyPassManager.h
@@ -26,6 +26,10 @@
namespace legacy {
+// Whether or not -debug-pass has been specified. For use to check if it's
+// specified alongside the new PM.
+bool debugPassSpecified();
+
class PassManagerImpl;
class FunctionPassManagerImpl;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97810.327597.patch
Type: text/x-patch
Size: 1860 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210302/f6e8b152/attachment.bin>
More information about the llvm-commits
mailing list