[Mlir-commits] [mlir] [mlir][EmitC] Do not convert illegal types in EmitC (PR #104571)

Matthias Gehre llvmlistbot at llvm.org
Tue Aug 20 00:00:51 PDT 2024


================
@@ -177,7 +177,8 @@ void mlir::populateMemRefToEmitCTypeConversion(TypeConverter &typeConverter) {
         }
         Type convertedElementType =
             typeConverter.convertType(memRefType.getElementType());
-        if (!convertedElementType)
+        if (!convertedElementType ||
----------------
mgehre-amd wrote:

I think we should instead change https://github.com/llvm/llvm-project/blob/main/mlir/lib/Conversion/MemRefToEmitC/MemRefToEmitCPass.cpp#L36 to 
```
    converter.addConversion([](Type type) -> std::optional<Type> {
      if (emitc::isSupportedEmitCType(type))
        return type;
      return {};
    });
```
which better allows to compose `populateMemRefToEmitCTypeConversion` with custom array element type conversions.

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


More information about the Mlir-commits mailing list