[Mlir-commits] [mlir] [mlir] Add missing materialization function diag for dialect convertion (PR #207689)

Matthias Springer llvmlistbot at llvm.org
Mon Aug 3 07:01:52 PDT 2026


================
@@ -3383,14 +3383,25 @@ legalizeUnresolvedMaterialization(RewriterBase &rewriter,
       rewriter.replaceOp(op, newMaterialization);
       return success();
     }
+    StringRef direction =
+        info.getMaterializationKind() == MaterializationKind::Target ? "target"
+                                                                     : "source";
+    InFlightDiagnostic diag = op.emitError()
+                              << "mismatch " << direction
+                              << " materialization function from ("
+                              << inputOperands.getTypes() << ") to ("
+                              << op.getResultTypes() << ")";
+    diag.attachNote(op->getUsers().begin()->getLoc())
+        << "require this materialization is here";
----------------
matthias-springer wrote:

Broken grammar in the error message here. "Mismatch function" also doesn't sound very intuitive. Can we keep the original error message and improve it a bit?

```
failed to legalize unresolved source materialization from ...
                              ^^^^^^
                     mention materialization kind
```

And:
```
... live after conversion (no type converter specified)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                             mention reason
```

Reason can be:
* no type converter specified
* no matching callback



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


More information about the Mlir-commits mailing list