Don't emit on op diagnostic in reproducer emission

This avoids dumping the module post emitting a reproducer, which results in
many MB logs where a reproducer has already been neatly generated.

Differential Revision: https://reviews.llvm.org/D93165
This commit is contained in:
Jacques Pienaar
2020-12-13 07:21:32 -08:00
parent 076f87a867
commit 9c3fa3d84d

View File

@@ -765,10 +765,14 @@ PassManager::runWithCrashRecovery(MutableArrayRef<std::unique_ptr<Pass>> passes,
std::string error;
if (failed(context.generate(error)))
return op->emitError("<MLIR-PassManager-Crash-Reproducer>: ") << error;
return op->emitError()
<< "A failure has been detected while processing the MLIR module, a "
"reproducer has been generated in '"
<< *crashReproducerFileName << "'";
bool shouldPrintOnOp = op->getContext()->shouldPrintOpOnDiagnostic();
op->getContext()->printOpOnDiagnostic(false);
op->emitError()
<< "A failure has been detected while processing the MLIR module, a "
"reproducer has been generated in '"
<< *crashReproducerFileName << "'";
op->getContext()->printOpOnDiagnostic(shouldPrintOnOp);
return failure();
}
//===----------------------------------------------------------------------===//