[Mlir-commits] [mlir] [mlir][Transforms] Report all `allowPatternRollback` violations as fatal errors (PR #148416)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sun Jul 13 02:04:26 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir-core

Author: Matthias Springer (matthias-springer)

<details>
<summary>Changes</summary>

Report all `allowPatternRollback` API violations as fatal errors. If violated, the IR is potentially in an invalid/inconsistent state from which the driver cannot recover.


---
Full diff: https://github.com/llvm/llvm-project/pull/148416.diff


1 Files Affected:

- (modified) mlir/lib/Transforms/Utils/DialectConversion.cpp (+2-3) 


``````````diff
diff --git a/mlir/lib/Transforms/Utils/DialectConversion.cpp b/mlir/lib/Transforms/Utils/DialectConversion.cpp
index 437dbcfea5288..4d01a83d37165 100644
--- a/mlir/lib/Transforms/Utils/DialectConversion.cpp
+++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp
@@ -2266,9 +2266,8 @@ OperationLegalizer::legalizeWithPattern(Operation *op,
     appliedPatterns.erase(&pattern);
     if (failed(result)) {
       if (!rewriterImpl.config.allowPatternRollback)
-        op->emitError("pattern '")
-            << pattern.getDebugName()
-            << "' produced IR that could not be legalized";
+        llvm::report_fatal_error("pattern '" + pattern.getDebugName() +
+                                 "' produced IR that could not be legalized");
       rewriterImpl.resetState(curState, pattern.getDebugName());
     }
     if (config.listener)

``````````

</details>


https://github.com/llvm/llvm-project/pull/148416


More information about the Mlir-commits mailing list