From 5de114b650d780dddffadff72af2a0374a1258cf Mon Sep 17 00:00:00 2001 From: Arthur Eubanks Date: Mon, 19 Jul 2021 13:35:57 -0700 Subject: [PATCH] [NewPM][opt] Add -debug-pass-manager=quiet to not print analysis info Reviewed By: asbirlea Differential Revision: https://reviews.llvm.org/D106307 --- llvm/test/Other/debug-pass-manager.ll | 19 +++++++++++++++++++ llvm/tools/opt/NewPMDriver.cpp | 5 ++++- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 llvm/test/Other/debug-pass-manager.ll diff --git a/llvm/test/Other/debug-pass-manager.ll b/llvm/test/Other/debug-pass-manager.ll new file mode 100644 index 0000000000000..e0851f822510e --- /dev/null +++ b/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 diff --git a/llvm/tools/opt/NewPMDriver.cpp b/llvm/tools/opt/NewPMDriver.cpp index 9ca7013d22306..8b1fbd09e40b3 100644 --- a/llvm/tools/opt/NewPMDriver.cpp +++ b/llvm/tools/opt/NewPMDriver.cpp @@ -52,7 +52,7 @@ cl::opt cl::value_desc("filename")); } // namespace llvm -enum class DebugLogging { None, Normal, Verbose }; +enum class DebugLogging { None, Normal, Verbose, Quiet }; static cl::opt DebugPM( "debug-pass-manager", cl::Hidden, cl::ValueOptional, @@ -60,6 +60,8 @@ static cl::opt DebugPM( 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"))); @@ -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);