[Mlir-commits] [mlir] [mlir][SCFToEmitC] Don't convert unsupported types in EmitC (PR #131786)

Marius Brehler llvmlistbot at llvm.org
Tue Mar 18 04:52:58 PDT 2025


================
@@ -322,7 +322,11 @@ void SCFToEmitCPass::runOnOperation() {
   // Fallback converter
   // See note https://mlir.llvm.org/docs/DialectConversion/#type-converter
   // Type converters are called most to least recently inserted
-  typeConverter.addConversion([](Type t) { return t; });
+  typeConverter.addConversion([](Type type) -> std::optional<Type> {
+    if (emitc::isSupportedEmitCType(type))
+      return type;
+    return {};
----------------
marbre wrote:

```suggestion
    if (!emitc::isSupportedEmitCType(type))
      return {};
    return type;
```
Might want to inverse the check to allow additional checks if needed later?

With this change we might also want to update the comment in L322-L324.

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


More information about the Mlir-commits mailing list