Improve error reporting on pass registration collision (NFC)
authorMehdi Amini <joker.eph@gmail.com>
Thu, 17 Jun 2021 01:28:17 +0000 (01:28 +0000)
committerMehdi Amini <joker.eph@gmail.com>
Thu, 17 Jun 2021 02:42:43 +0000 (02:42 +0000)
Differential Revision: https://reviews.llvm.org/D104430

mlir/lib/Pass/PassRegistry.cpp

index 676f463..0d3e059 100644 (file)
@@ -116,10 +116,11 @@ void mlir::registerPass(StringRef arg, StringRef description,
   // arg before it.
   TypeID entryTypeID = function()->getTypeID();
   auto it = passRegistryTypeIDs->try_emplace(arg, entryTypeID).first;
-  if (it->second != entryTypeID) {
-    llvm_unreachable("pass allocator creates a different pass than previously "
-                     "registered");
-  }
+  if (it->second != entryTypeID)
+    llvm::report_fatal_error(
+        "pass allocator creates a different pass than previously "
+        "registered for pass " +
+        arg);
 }
 
 void mlir::registerPass(const PassAllocatorFunction &function) {