[Mlir-commits] [mlir] Handled UnrealizedConversionCast for C code generation and validated tests (PR #160159)

Simon Camphausen llvmlistbot at llvm.org
Sat Oct 11 08:16:05 PDT 2025


simon-camp wrote:

I would try to get this running [https://godbolt.org/z/b7Ko1a6dv](https://godbolt.org/z/b7Ko1a6dv), by replacing `%6 = cast %5 : !emitc.ptr<!emitc.opaque<"void">> to !emitc.ptr<i32>` with `%6 = cast %5 : !emitc.ptr<!emitc.opaque<"void">> to !emitc.ptr<!emitc.array<3xi32>>`. The cast is generated in the [AllocOp Conversion](https://github.com/llvm/llvm-project/blob/0f73e75bf78c4adebcc674c30ca253118f0bcdfc/mlir/lib/Conversion/MemRefToEmitC/MemRefToEmitC.cpp#L199).

But as I think about this now, you would get another unrealized conversion cast from `!emitc.ptr<!emitc.array<3xi32>>` to `!emitc.array<2x3xi32>>` unless every array type undergoes array to pointer decay.

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


More information about the Mlir-commits mailing list