diff --git a/llvm/include/llvm/Passes/StandardInstrumentations.h b/llvm/include/llvm/Passes/StandardInstrumentations.h --- a/llvm/include/llvm/Passes/StandardInstrumentations.h +++ b/llvm/include/llvm/Passes/StandardInstrumentations.h @@ -56,12 +56,11 @@ class OptNoneInstrumentation { public: - OptNoneInstrumentation(bool DebugLogging) : DebugLogging(DebugLogging) {} + OptNoneInstrumentation() {} void registerCallbacks(PassInstrumentationCallbacks &PIC); private: bool skip(StringRef PassID, Any IR); - bool DebugLogging; }; // Debug logging for transformation and analysis passes. @@ -83,8 +82,7 @@ OptNoneInstrumentation OptNone; public: - StandardInstrumentations(bool DebugLogging) - : PrintPass(DebugLogging), OptNone(DebugLogging) {} + StandardInstrumentations(bool DebugLogging) : PrintPass(DebugLogging) {} void registerCallbacks(PassInstrumentationCallbacks &PIC); diff --git a/llvm/lib/Passes/StandardInstrumentations.cpp b/llvm/lib/Passes/StandardInstrumentations.cpp --- a/llvm/lib/Passes/StandardInstrumentations.cpp +++ b/llvm/lib/Passes/StandardInstrumentations.cpp @@ -297,12 +297,7 @@ } else if (any_isa(IR)) { F = any_cast(IR)->getHeader()->getParent(); } - if (F && F->hasOptNone()) { - if (DebugLogging) - dbgs() << "Skipping pass: " << PassID << " (optnone)\n"; - return false; - } - return true; + return !(F && F->hasOptNone()); } void PrintPassInstrumentation::registerCallbacks( @@ -314,6 +309,14 @@ if (!DebugPMVerbose) SpecialPasses.emplace_back("PassAdaptor"); + PIC.registerBeforeSkippedPassCallback( + [SpecialPasses](StringRef PassID, Any IR) { + if (isSpecialPass(PassID, SpecialPasses)) + return; + + dbgs() << "Skipping pass: " << PassID << "\n"; + }); + PIC.registerBeforeNonSkippedPassCallback( [SpecialPasses](StringRef PassID, Any IR) { if (isSpecialPass(PassID, SpecialPasses))