[Mlir-commits] [mlir] 20211b3 - [mlir] Fix tsan failure in PassCrashRecovery

River Riddle llvmlistbot at llvm.org
Mon Oct 18 08:30:15 PDT 2021


Author: River Riddle
Date: 2021-10-18T15:25:21Z
New Revision: 20211b32612bb6dc1dda29b75552731b38b443d2

URL: https://github.com/llvm/llvm-project/commit/20211b32612bb6dc1dda29b75552731b38b443d2
DIFF: https://github.com/llvm/llvm-project/commit/20211b32612bb6dc1dda29b75552731b38b443d2.diff

LOG: [mlir] Fix tsan failure in PassCrashRecovery

Don't set printOpOnDiagnostic, as this is not safe to call from a threaded context.

Differential Revision: https://reviews.llvm.org/D111752

Added: 
    

Modified: 
    mlir/lib/Pass/PassCrashRecovery.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Pass/PassCrashRecovery.cpp b/mlir/lib/Pass/PassCrashRecovery.cpp
index d4657b072f7c6..fdc995c335ccc 100644
--- a/mlir/lib/Pass/PassCrashRecovery.cpp
+++ b/mlir/lib/Pass/PassCrashRecovery.cpp
@@ -153,8 +153,7 @@ void RecoveryReproducerContext::crashHandler(void *) {
     context->generate(description);
 
     // Emit an error using information only available within the context.
-    context->preCrashOperation->getContext()->printOpOnDiagnostic(false);
-    context->preCrashOperation->emitError()
+    emitError(context->preCrashOperation->getLoc())
         << "A failure has been detected while processing the MLIR module:"
         << description;
   }
@@ -235,13 +234,9 @@ void PassCrashReproducerGenerator::finalize(Operation *rootOp,
   if (succeeded(executionResult))
     return impl->activeContexts.clear();
 
-  MLIRContext *context = rootOp->getContext();
-  bool shouldPrintOnOp = context->shouldPrintOpOnDiagnostic();
-  context->printOpOnDiagnostic(false);
-  InFlightDiagnostic diag = rootOp->emitError()
+  InFlightDiagnostic diag = emitError(rootOp->getLoc())
                             << "Failures have been detected while "
                                "processing an MLIR pass pipeline";
-  context->printOpOnDiagnostic(shouldPrintOnOp);
 
   // If we are generating a global reproducer, we include all of the running
   // passes in the error message for the only active context.


        


More information about the Mlir-commits mailing list