[Mlir-commits] [mlir] MLIR Rewriters: add new listener to emit match failures to user, enhance docs (PR #94130)

Mehdi Amini llvmlistbot at llvm.org
Mon Jun 3 19:17:22 PDT 2024


================
@@ -511,6 +512,50 @@ class RewriterBase : public OpBuilder {
     OpBuilder::Listener *listener;
   };
 
+  /// A listener that emits all notifyMatchFailure calls
+  /// with the given DiagnosticSeverity (default is Error).
+  /// This can be used so that any notifyMatchFailure calls will be emitted
+  /// as a message with the given severity (Remark will be used for Note)
+  struct MatchFailureEmittingListener : public RewriterBase::Listener {
----------------
joker-eph wrote:

>  But if all that applyPartialConversion returns is LogicalResult, then how else do you describe to the user that a lowering step failed?

`applyPartialConversion` has an 4th argument to collect the operation that couldn't be legalized, which allows you to diagnose after the fact if you'd like. You could print the list of the operations that couldn't be legalized if you'd like.


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


More information about the Mlir-commits mailing list