Don't emit on op diagnostic in reproducer emission
authorJacques Pienaar <jpienaar@google.com>
Sun, 13 Dec 2020 15:21:32 +0000 (07:21 -0800)
committerJacques Pienaar <jpienaar@google.com>
Sun, 13 Dec 2020 15:21:32 +0000 (07:21 -0800)
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

mlir/lib/Pass/Pass.cpp

index 056da035a5b5ba4a92696187477d52add372d29d..f53a087fac47c076de1479132d1bf59351f39272 100644 (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();
 }
 
 //===----------------------------------------------------------------------===//