diff --git a/mlir/lib/Pass/PassCrashRecovery.cpp b/mlir/lib/Pass/PassCrashRecovery.cpp --- a/mlir/lib/Pass/PassCrashRecovery.cpp +++ b/mlir/lib/Pass/PassCrashRecovery.cpp @@ -258,6 +258,8 @@ formatPassOpReproducerMessage(note, value); }); note << "]: " << description; + impl->runningPasses.clear(); + impl->activeContexts.clear(); return; } @@ -278,6 +280,7 @@ note << ": " << description; impl->activeContexts.clear(); + impl->runningPasses.clear(); } void PassCrashReproducerGenerator::prepareReproducerFor(Pass *pass, @@ -359,12 +362,18 @@ } void runAfterPassFailed(Pass *pass, Operation *op) override { + // Only generate one reproducer per crash reproducer instrumentation. + if (alreadyFailed) + return; + + alreadyFailed = true; generator.finalize(op, /*executionResult=*/failure()); } private: /// The generator used to create crash reproducers. PassCrashReproducerGenerator &generator; + bool alreadyFailed = false; }; } // namespace