forked from OSchip/llvm-project
[mlir][Pass] Remove the verifierPass now that verification is run during normal pass execution
A recent refactoring removed the need to interleave verifier passes and instead opted to verify during the normal execution of passes instead. As such, the old verify pass is no longer necessary and can be removed. Differential Revision: https://reviews.llvm.org/D91212
This commit is contained in:
parent
935ca5a1a7
commit
811001380f
|
@ -118,7 +118,7 @@ public:
|
|||
|
||||
/// Prints out the pass in the textual representation of pipelines. If this is
|
||||
/// an adaptor pass, print with the op_name(sub_pass,...) format.
|
||||
void printAsTextualPipeline(raw_ostream &os, bool filterVerifier = true);
|
||||
void printAsTextualPipeline(raw_ostream &os);
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// Statistics
|
||||
|
|
|
@ -105,7 +105,7 @@ public:
|
|||
/// of pipelines.
|
||||
/// Note: The quality of the string representation depends entirely on the
|
||||
/// the correctness of per-pass overrides of Pass::printAsTextualPipeline.
|
||||
void printAsTextualPipeline(raw_ostream &os, bool filterVerifier = true);
|
||||
void printAsTextualPipeline(raw_ostream &os);
|
||||
|
||||
/// Raw dump of the pass manager to llvm::errs().
|
||||
void dump();
|
||||
|
|
|
@ -95,11 +95,6 @@ private:
|
|||
};
|
||||
} // end anonymous namespace
|
||||
|
||||
/// Returns true if the given pass is hidden from IR printing.
|
||||
static bool isHiddenPass(Pass *pass) {
|
||||
return isa<OpToOpPassAdaptor, VerifierPass>(pass);
|
||||
}
|
||||
|
||||
static void printIR(Operation *op, bool printModuleScope, raw_ostream &out,
|
||||
OpPrintingFlags flags) {
|
||||
// Check to see if we are printing the top-level module.
|
||||
|
@ -133,7 +128,7 @@ static void printIR(Operation *op, bool printModuleScope, raw_ostream &out,
|
|||
|
||||
/// Instrumentation hooks.
|
||||
void IRPrinterInstrumentation::runBeforePass(Pass *pass, Operation *op) {
|
||||
if (isHiddenPass(pass))
|
||||
if (isa<OpToOpPassAdaptor>(pass))
|
||||
return;
|
||||
// If the config asked to detect changes, record the current fingerprint.
|
||||
if (config->shouldPrintAfterOnlyOnChange())
|
||||
|
@ -148,7 +143,7 @@ void IRPrinterInstrumentation::runBeforePass(Pass *pass, Operation *op) {
|
|||
}
|
||||
|
||||
void IRPrinterInstrumentation::runAfterPass(Pass *pass, Operation *op) {
|
||||
if (isHiddenPass(pass))
|
||||
if (isa<OpToOpPassAdaptor>(pass))
|
||||
return;
|
||||
// If the config asked to detect changes, compare the current fingerprint with
|
||||
// the previous.
|
||||
|
|
|
@ -52,13 +52,13 @@ void Pass::copyOptionValuesFrom(const Pass *other) {
|
|||
|
||||
/// Prints out the pass in the textual representation of pipelines. If this is
|
||||
/// an adaptor pass, print with the op_name(sub_pass,...) format.
|
||||
void Pass::printAsTextualPipeline(raw_ostream &os, bool filterVerifier) {
|
||||
void Pass::printAsTextualPipeline(raw_ostream &os) {
|
||||
// Special case for adaptors to use the 'op_name(sub_passes)' format.
|
||||
if (auto *adaptor = dyn_cast<OpToOpPassAdaptor>(this)) {
|
||||
llvm::interleaveComma(adaptor->getPassManagers(), os,
|
||||
[&](OpPassManager &pm) {
|
||||
os << pm.getOpName() << "(";
|
||||
pm.printAsTextualPipeline(os, filterVerifier);
|
||||
pm.printAsTextualPipeline(os);
|
||||
os << ")";
|
||||
});
|
||||
return;
|
||||
|
@ -74,16 +74,6 @@ void Pass::printAsTextualPipeline(raw_ostream &os, bool filterVerifier) {
|
|||
passOptions.print(os);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Verifier Passes
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void VerifierPass::runOnOperation() {
|
||||
if (failed(verify(getOperation())))
|
||||
signalPassFailure();
|
||||
markAllAnalysesPreserved();
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// OpPassManagerImpl
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -198,9 +188,9 @@ void OpPassManagerImpl::coalesceAdjacentAdaptorPasses() {
|
|||
// Otherwise, merge into the existing adaptor and delete the current one.
|
||||
currentAdaptor->mergeInto(*lastAdaptor);
|
||||
it->reset();
|
||||
} else if (lastAdaptor && !isa<VerifierPass>(*it)) {
|
||||
// If this pass is not an adaptor and not a verifier pass, then coalesce
|
||||
// and forget any existing adaptor.
|
||||
} else if (lastAdaptor) {
|
||||
// If this pass is not an adaptor, then coalesce and forget any existing
|
||||
// adaptor.
|
||||
for (auto &pm : lastAdaptor->getPassManagers())
|
||||
pm.getImpl().coalesceAdjacentAdaptorPasses();
|
||||
lastAdaptor = nullptr;
|
||||
|
@ -223,10 +213,6 @@ void OpPassManagerImpl::splitAdaptorPasses() {
|
|||
std::swap(passes, oldPasses);
|
||||
|
||||
for (std::unique_ptr<Pass> &pass : oldPasses) {
|
||||
// Ignore verifier passes, they are added back in the "addPass()" calls.
|
||||
if (isa<VerifierPass>(pass.get()))
|
||||
continue;
|
||||
|
||||
// If this pass isn't an adaptor, move it directly to the new pass list.
|
||||
auto *currentAdaptor = dyn_cast<OpToOpPassAdaptor>(pass.get());
|
||||
if (!currentAdaptor) {
|
||||
|
@ -237,12 +223,8 @@ void OpPassManagerImpl::splitAdaptorPasses() {
|
|||
// Otherwise, split the adaptors of each manager within the adaptor.
|
||||
for (OpPassManager &adaptorPM : currentAdaptor->getPassManagers()) {
|
||||
adaptorPM.getImpl().splitAdaptorPasses();
|
||||
|
||||
// Add all non-verifier passes to this pass manager.
|
||||
for (std::unique_ptr<Pass> &nestedPass : adaptorPM.getImpl().passes) {
|
||||
if (!isa<VerifierPass>(nestedPass.get()))
|
||||
nest(adaptorPM.getOpName()).addPass(std::move(nestedPass));
|
||||
}
|
||||
for (std::unique_ptr<Pass> &nestedPass : adaptorPM.getImpl().passes)
|
||||
nest(adaptorPM.getOpName()).addPass(std::move(nestedPass));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -311,30 +293,21 @@ Identifier OpPassManager::getOpName(MLIRContext &context) const {
|
|||
|
||||
/// Prints out the given passes as the textual representation of a pipeline.
|
||||
static void printAsTextualPipeline(ArrayRef<std::unique_ptr<Pass>> passes,
|
||||
raw_ostream &os,
|
||||
bool filterVerifier = true) {
|
||||
// Filter out passes that are not part of the public pipeline.
|
||||
auto filteredPasses =
|
||||
llvm::make_filter_range(passes, [&](const std::unique_ptr<Pass> &pass) {
|
||||
return !filterVerifier || !isa<VerifierPass>(pass);
|
||||
});
|
||||
llvm::interleaveComma(filteredPasses, os,
|
||||
[&](const std::unique_ptr<Pass> &pass) {
|
||||
pass->printAsTextualPipeline(os, filterVerifier);
|
||||
});
|
||||
raw_ostream &os) {
|
||||
llvm::interleaveComma(passes, os, [&](const std::unique_ptr<Pass> &pass) {
|
||||
pass->printAsTextualPipeline(os);
|
||||
});
|
||||
}
|
||||
|
||||
/// Prints out the passes of the pass manager as the textual representation
|
||||
/// of pipelines.
|
||||
void OpPassManager::printAsTextualPipeline(raw_ostream &os,
|
||||
bool filterVerifier) {
|
||||
::printAsTextualPipeline(impl->passes, os, filterVerifier);
|
||||
void OpPassManager::printAsTextualPipeline(raw_ostream &os) {
|
||||
::printAsTextualPipeline(impl->passes, os);
|
||||
}
|
||||
|
||||
void OpPassManager::dump() {
|
||||
llvm::errs() << "Pass Manager with " << impl->passes.size() << " passes: ";
|
||||
::printAsTextualPipeline(impl->passes, llvm::errs(),
|
||||
/*filterVerifier=*/false);
|
||||
::printAsTextualPipeline(impl->passes, llvm::errs());
|
||||
llvm::errs() << "\n";
|
||||
}
|
||||
|
||||
|
|
|
@ -14,15 +14,6 @@
|
|||
namespace mlir {
|
||||
namespace detail {
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Verifier Pass
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/// Pass to verify an operation and signal failure if necessary.
|
||||
class VerifierPass : public PassWrapper<VerifierPass, OperationPass<>> {
|
||||
void runOnOperation() override;
|
||||
};
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// OpToOpPassAdaptor
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
Loading…
Reference in New Issue