diff --git a/mlir/lib/Pass/Pass.cpp b/mlir/lib/Pass/Pass.cpp --- a/mlir/lib/Pass/Pass.cpp +++ b/mlir/lib/Pass/Pass.cpp @@ -227,10 +227,14 @@ std::swap(passes, oldPasses); for (std::unique_ptr &pass : oldPasses) { + // Ignore verifier passes, they are added back in the "addPass()" calls. + if (isa(pass.get())) + continue; + // If this pass isn't an adaptor, move it directly to the new pass list. auto *currentAdaptor = dyn_cast(pass.get()); if (!currentAdaptor) { - passes.push_back(std::move(pass)); + addPass(std::move(pass)); continue; } diff --git a/mlir/test/Pass/crash-recovery.mlir b/mlir/test/Pass/crash-recovery.mlir --- a/mlir/test/Pass/crash-recovery.mlir +++ b/mlir/test/Pass/crash-recovery.mlir @@ -3,6 +3,9 @@ // RUN: mlir-opt %s -pass-pipeline='func(test-function-pass, test-pass-crash)' -pass-pipeline-crash-reproducer=%t -verify-diagnostics -pass-pipeline-local-reproducer // RUN: cat %t | FileCheck -check-prefix=REPRO_LOCAL %s +// Check that we correctly handle verifiers passes with local reproducer, this use to crash. +// RUN: mlir-opt %s -test-function-pass -test-function-pass -test-module-pass -pass-pipeline-crash-reproducer=%t -pass-pipeline-local-reproducer + // expected-error@+1 {{A failure has been detected while processing the MLIR module}} module { func @foo() {