[PATCH] D85493: [NewPM] Print 'Skipping pass' as pass instrumentation
Arthur Eubanks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 7 10:52:18 PDT 2020
aeubanks updated this revision to Diff 283951.
aeubanks added a comment.
Add test
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D85493/new/
https://reviews.llvm.org/D85493
Files:
llvm/include/llvm/IR/Verifier.h
llvm/include/llvm/Passes/StandardInstrumentations.h
llvm/lib/Passes/StandardInstrumentations.cpp
llvm/test/Feature/optnone-opt.ll
Index: llvm/test/Feature/optnone-opt.ll
===================================================================
--- llvm/test/Feature/optnone-opt.ll
+++ llvm/test/Feature/optnone-opt.ll
@@ -10,6 +10,7 @@
; RUN: opt -enable-npm-optnone -O3 -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-O1 --check-prefix=NPM-O2O3
; RUN: opt -enable-npm-optnone -dce -gvn-hoist -loweratomic -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-MORE
; RUN: opt -enable-npm-optnone -indvars -licm -loop-deletion -loop-idiom -loop-instsimplify -loop-reduce -loop-unroll -simple-loop-unswitch -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-LOOP
+; RUN: opt -enable-npm-optnone -passes='function(verify)' -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-VERIFY
; REQUIRES: asserts
@@ -90,3 +91,6 @@
; NPM-LOOP-DAG: Skipping pass: LICMPass
; NPM-LOOP-DAG: Skipping pass: LoopIdiomRecognizePass
; NPM-LOOP-DAG: Skipping pass: LoopInstSimplifyPass
+
+; VerifierPass should not be skipped
+; NPM-VERIFY-NOT: Skipping pass
Index: llvm/lib/Passes/StandardInstrumentations.cpp
===================================================================
--- llvm/lib/Passes/StandardInstrumentations.cpp
+++ llvm/lib/Passes/StandardInstrumentations.cpp
@@ -297,12 +297,7 @@
} else if (any_isa<const Loop *>(IR)) {
F = any_cast<const Loop *>(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))
Index: llvm/include/llvm/Passes/StandardInstrumentations.h
===================================================================
--- llvm/include/llvm/Passes/StandardInstrumentations.h
+++ 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);
Index: llvm/include/llvm/IR/Verifier.h
===================================================================
--- llvm/include/llvm/IR/Verifier.h
+++ llvm/include/llvm/IR/Verifier.h
@@ -141,6 +141,8 @@
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+
+ static bool isRequired() { return true; }
};
} // end namespace llvm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85493.283951.patch
Type: text/x-patch
Size: 3534 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200807/c8eade98/attachment.bin>
More information about the llvm-commits
mailing list