[PATCH] D75399: Ensure that multi-threading is disabled when enabling IRPrinting with module scope

Mehdi Amini via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 29 10:34:09 PST 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG07aa9ae23b8e: Ensure that multi-threading is disabled when enabling IRPrinting with moduleā€¦ (authored by joker-eph-DISABLED).

Changed prior to commit:
  https://reviews.llvm.org/D75399?vs=247408&id=247451#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75399/new/

https://reviews.llvm.org/D75399

Files:
  mlir/include/mlir/Pass/PassManager.h
  mlir/lib/Pass/IRPrinting.cpp
  mlir/lib/Pass/Pass.cpp


Index: mlir/lib/Pass/Pass.cpp
===================================================================
--- mlir/lib/Pass/Pass.cpp
+++ mlir/lib/Pass/Pass.cpp
@@ -598,6 +598,10 @@
   getImpl().disableThreads = disable;
 }
 
+bool PassManager::isMultithreadingEnabled() {
+  return !getImpl().disableThreads;
+}
+
 /// Enable support for the pass manager to generate a reproducer on the event
 /// of a crash or a pass failure. `outputFile` is a .mlir filename used to write
 /// the generated reproducer.
Index: mlir/lib/Pass/IRPrinting.cpp
===================================================================
--- mlir/lib/Pass/IRPrinting.cpp
+++ mlir/lib/Pass/IRPrinting.cpp
@@ -256,6 +256,9 @@
 /// Add an instrumentation to print the IR before and after pass execution,
 /// using the provided configuration.
 void PassManager::enableIRPrinting(std::unique_ptr<IRPrinterConfig> config) {
+  if (config->shouldPrintAtModuleScope() && isMultithreadingEnabled())
+    llvm::report_fatal_error("IR printing can't be setup on a pass-manager "
+                             "without disabling multi-threading first.");
   addInstrumentation(
       std::make_unique<IRPrinterInstrumentation>(std::move(config)));
 }
Index: mlir/include/mlir/Pass/PassManager.h
===================================================================
--- mlir/include/mlir/Pass/PassManager.h
+++ mlir/include/mlir/Pass/PassManager.h
@@ -139,6 +139,10 @@
   /// Disable support for multi-threading within the pass manager.
   void disableMultithreading(bool disable = true);
 
+  /// Return true if the pass manager is configured with multi-threading
+  /// enabled.
+  bool isMultithreadingEnabled();
+
   /// Enable support for the pass manager to generate a reproducer on the event
   /// of a crash or a pass failure. `outputFile` is a .mlir filename used to
   /// write the generated reproducer.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75399.247451.patch
Type: text/x-patch
Size: 1867 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200229/edf61ae3/attachment.bin>


More information about the llvm-commits mailing list