Skip to content

Commit 6dcbea8

Browse files
committed
[NewPM] Use PassInstrumentation for -verify-each
This removes "VerifyEachPass" parameters from a lot of functions which is nice. Don't verify after special passes or VerifierPass. This introduces verification on loop and cgscc passes, verifying the corresponding function/module. Reviewed By: ychen Differential Revision: https://reviews.llvm.org/D88764
1 parent a4961f0 commit 6dcbea8

File tree

10 files changed

+217
-170
lines changed

10 files changed

+217
-170
lines changed

llvm/include/llvm/Passes/PassBuilder.h

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,6 @@ class PassBuilder {
488488
/// preferred when a pipeline is largely of one type, but one or just a few
489489
/// passes are of different types(See PassBuilder.cpp for examples).
490490
Error parsePassPipeline(ModulePassManager &MPM, StringRef PipelineText,
491-
bool VerifyEachPass = true,
492491
bool DebugLogging = false);
493492

494493
/// {{@ Parse a textual pass pipeline description into a specific PassManager
@@ -499,13 +498,10 @@ class PassBuilder {
499498
///
500499
/// function(lpass)
501500
Error parsePassPipeline(CGSCCPassManager &CGPM, StringRef PipelineText,
502-
bool VerifyEachPass = true,
503501
bool DebugLogging = false);
504502
Error parsePassPipeline(FunctionPassManager &FPM, StringRef PipelineText,
505-
bool VerifyEachPass = true,
506503
bool DebugLogging = false);
507504
Error parsePassPipeline(LoopPassManager &LPM, StringRef PipelineText,
508-
bool VerifyEachPass = true,
509505
bool DebugLogging = false);
510506
/// @}}
511507

@@ -682,7 +678,7 @@ class PassBuilder {
682678
/// PassManagers and populate the passed ModulePassManager.
683679
void registerParseTopLevelPipelineCallback(
684680
const std::function<bool(ModulePassManager &, ArrayRef<PipelineElement>,
685-
bool VerifyEachPass, bool DebugLogging)> &C);
681+
bool DebugLogging)> &C);
686682

687683
/// Add PGOInstrumenation passes for O0 only.
688684
void addPGOInstrPassesForO0(ModulePassManager &MPM, bool DebugLogging,
@@ -706,27 +702,27 @@ class PassBuilder {
706702
parsePipelineText(StringRef Text);
707703

708704
Error parseModulePass(ModulePassManager &MPM, const PipelineElement &E,
709-
bool VerifyEachPass, bool DebugLogging);
705+
bool DebugLogging);
710706
Error parseCGSCCPass(CGSCCPassManager &CGPM, const PipelineElement &E,
711-
bool VerifyEachPass, bool DebugLogging);
707+
bool DebugLogging);
712708
Error parseFunctionPass(FunctionPassManager &FPM, const PipelineElement &E,
713-
bool VerifyEachPass, bool DebugLogging);
709+
bool DebugLogging);
714710
Error parseLoopPass(LoopPassManager &LPM, const PipelineElement &E,
715-
bool VerifyEachPass, bool DebugLogging);
711+
bool DebugLogging);
716712
bool parseAAPassName(AAManager &AA, StringRef Name);
717713

718714
Error parseLoopPassPipeline(LoopPassManager &LPM,
719715
ArrayRef<PipelineElement> Pipeline,
720-
bool VerifyEachPass, bool DebugLogging);
716+
bool DebugLogging);
721717
Error parseFunctionPassPipeline(FunctionPassManager &FPM,
722718
ArrayRef<PipelineElement> Pipeline,
723-
bool VerifyEachPass, bool DebugLogging);
719+
bool DebugLogging);
724720
Error parseCGSCCPassPipeline(CGSCCPassManager &CGPM,
725721
ArrayRef<PipelineElement> Pipeline,
726-
bool VerifyEachPass, bool DebugLogging);
722+
bool DebugLogging);
727723
Error parseModulePassPipeline(ModulePassManager &MPM,
728724
ArrayRef<PipelineElement> Pipeline,
729-
bool VerifyEachPass, bool DebugLogging);
725+
bool DebugLogging);
730726

731727
void addPGOInstrPasses(ModulePassManager &MPM, bool DebugLogging,
732728
OptimizationLevel Level, bool RunProfileGen, bool IsCS,
@@ -759,7 +755,7 @@ class PassBuilder {
759755
2>
760756
ModulePipelineParsingCallbacks;
761757
SmallVector<std::function<bool(ModulePassManager &, ArrayRef<PipelineElement>,
762-
bool VerifyEachPass, bool DebugLogging)>,
758+
bool DebugLogging)>,
763759
2>
764760
TopLevelPipelineParsingCallbacks;
765761
// CGSCC callbacks

llvm/include/llvm/Passes/StandardInstrumentations.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,14 @@ class IRChangePrinter : public ChangePrinter<std::string> {
213213
raw_ostream &Out;
214214
};
215215

216+
class VerifyInstrumentation {
217+
bool DebugLogging;
218+
219+
public:
220+
VerifyInstrumentation(bool DebugLogging) : DebugLogging(DebugLogging) {}
221+
void registerCallbacks(PassInstrumentationCallbacks &PIC);
222+
};
223+
216224
/// This class provides an interface to register all the standard pass
217225
/// instrumentations and manages their state (if any).
218226
class StandardInstrumentations {
@@ -222,9 +230,13 @@ class StandardInstrumentations {
222230
OptNoneInstrumentation OptNone;
223231
PreservedCFGCheckerInstrumentation PreservedCFGChecker;
224232
IRChangePrinter PrintChangedIR;
233+
VerifyInstrumentation Verify;
234+
235+
bool VerifyEach;
225236

226237
public:
227-
StandardInstrumentations(bool DebugLogging) : PrintPass(DebugLogging) {}
238+
StandardInstrumentations(bool DebugLogging, bool VerifyEach = false)
239+
: PrintPass(DebugLogging), Verify(DebugLogging), VerifyEach(VerifyEach) {}
228240

229241
void registerCallbacks(PassInstrumentationCallbacks &PIC);
230242

0 commit comments

Comments
 (0)