Skip to content

Commit

Permalink
[NewPM][opt] Add -debug-pass-manager=quiet to not print analysis info
Browse files Browse the repository at this point in the history
Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D106307
  • Loading branch information
aeubanks committed Jul 19, 2021
1 parent 6cbb35d commit 5de114b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
19 changes: 19 additions & 0 deletions llvm/test/Other/debug-pass-manager.ll
@@ -0,0 +1,19 @@
; RUN: opt -passes=inline < %s -debug-pass-manager 2>&1 | FileCheck %s --check-prefix=NORMAL
; RUN: opt -passes=inline < %s -debug-pass-manager=quiet 2>&1 | FileCheck %s --check-prefix=QUIET
; RUN: opt -passes=inline < %s -debug-pass-manager=verbose 2>&1 | FileCheck %s --check-prefix=VERBOSE

define void @a() {
ret void
}

; QUIET-NOT: Running pass: ModuleToPostOrderCGSCCPassAdaptor
; QUIET: Running pass: InlinerPass
; QUIET-NOT: Running analysis

; NORMAL-NOT: Running pass: ModuleToPostOrderCGSCCPassAdaptor
; NORMAL: Running pass: InlinerPass
; NORMAL: Running analysis

; VERBOSE: Running pass: ModuleToPostOrderCGSCCPassAdaptor
; VERBOSE: Running pass: InlinerPass
; VERBOSE: Running analysis
5 changes: 4 additions & 1 deletion llvm/tools/opt/NewPMDriver.cpp
Expand Up @@ -52,14 +52,16 @@ cl::opt<std::string>
cl::value_desc("filename"));
} // namespace llvm

enum class DebugLogging { None, Normal, Verbose };
enum class DebugLogging { None, Normal, Verbose, Quiet };

static cl::opt<DebugLogging> DebugPM(
"debug-pass-manager", cl::Hidden, cl::ValueOptional,
cl::desc("Print pass management debugging information"),
cl::init(DebugLogging::None),
cl::values(
clEnumValN(DebugLogging::Normal, "", ""),
clEnumValN(DebugLogging::Quiet, "quiet",
"Skip printing info about analyses"),
clEnumValN(
DebugLogging::Verbose, "verbose",
"Print extra information about adaptors and pass managers")));
Expand Down Expand Up @@ -293,6 +295,7 @@ bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM,
PassInstrumentationCallbacks PIC;
PrintPassOptions PrintPassOpts;
PrintPassOpts.Verbose = DebugPM == DebugLogging::Verbose;
PrintPassOpts.SkipAnalyses = DebugPM == DebugLogging::Quiet;
StandardInstrumentations SI(DebugPM != DebugLogging::None, VerifyEachPass,
PrintPassOpts);
SI.registerCallbacks(PIC, &FAM);
Expand Down

0 comments on commit 5de114b

Please sign in to comment.