[Mlir-commits] [mlir] 702f06a - Fix crash in the pass pipeline when local reproducer is enabled
Mehdi Amini
llvmlistbot at llvm.org
Mon Sep 21 01:53:02 PDT 2020
Author: Mehdi Amini
Date: 2020-09-21T08:52:50Z
New Revision: 702f06ad14ac61d364b773e5a1f4d8b0b0214553
URL: https://github.com/llvm/llvm-project/commit/702f06ad14ac61d364b773e5a1f4d8b0b0214553
DIFF: https://github.com/llvm/llvm-project/commit/702f06ad14ac61d364b773e5a1f4d8b0b0214553.diff
LOG: Fix crash in the pass pipeline when local reproducer is enabled
This crash only happens when a function pass is followed by a module
pass. In this case the splitting of the pass pipeline didn't handle
properly the verifier passes and ended up with an odd number of pass in
the pipeline, breaking an assumption of the local crash reproducer
executor and hitting an assertion.
Differential Revision: https://reviews.llvm.org/D88000
Added:
Modified:
mlir/lib/Pass/Pass.cpp
mlir/test/Pass/crash-recovery.mlir
Removed:
################################################################################
diff --git a/mlir/lib/Pass/Pass.cpp b/mlir/lib/Pass/Pass.cpp
index 3ac41cde7911..2b49d9309322 100644
--- a/mlir/lib/Pass/Pass.cpp
+++ b/mlir/lib/Pass/Pass.cpp
@@ -227,10 +227,14 @@ 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) {
- 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
index 2de7e505b445..0d654b63a4d0 100644
--- 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 at +1 {{A failure has been detected while processing the MLIR module}}
module {
func @foo() {
More information about the Mlir-commits
mailing list