1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

[opt] Error if -debug-pass is specified alongside the new PM

Reviewed By: ychen

Differential Revision: https://reviews.llvm.org/D97810
This commit is contained in:
Arthur Eubanks 2021-03-02 14:49:46 -08:00
parent 15c77322ba
commit 83c7bddf7d
4 changed files with 16 additions and 0 deletions

View File

@ -26,6 +26,10 @@ class Module;
namespace legacy { 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 PassManagerImpl;
class FunctionPassManagerImpl; class FunctionPassManagerImpl;

View File

@ -242,6 +242,8 @@ void PassManagerPrettyStackEntry::print(raw_ostream &OS) const {
namespace llvm { namespace llvm {
namespace legacy { namespace legacy {
bool debugPassSpecified() { return PassDebugging != Disabled; }
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// FunctionPassManagerImpl // FunctionPassManagerImpl
// //

View File

@ -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

View File

@ -775,6 +775,12 @@ int main(int argc, char **argv) {
"full list of passes, see the '--print-passes' flag.\n"; "full list of passes, see the '--print-passes' flag.\n";
return 1; 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 (-enable-new-pm=0)\n";
return 1;
}
if (PassPipeline.getNumOccurrences() > 0 && PassList.size() > 0) { if (PassPipeline.getNumOccurrences() > 0 && PassList.size() > 0) {
errs() errs()
<< "Cannot specify passes via both -foo-pass and --passes=foo-pass\n"; << "Cannot specify passes via both -foo-pass and --passes=foo-pass\n";