[Mlir-commits] [mlir] [MLIR][EmitC] Add support for pointer-array types in the TypeConverter and related MemRef-to-EmitC operations, and update the C emitter. (PR #160159)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Jan 9 04:41:46 PST 2026
LekkalaSravya3 wrote:
@aniragil , @simon-camp
For memref load and store, instead of using direct multi-dimensional subscripting on pointer<array<…>>, the access is rewritten to use a flattened pointer and flattened index.
This is required due to EmitC semantics: taking address_of produces an lvalue, and lvalues cannot wrap or preserve array types. As a result, the generated value cannot be represented as ptr<array<…>>, and emitc.subscript does not accept pointer<array> operands directly.
To handle this consistently, the memref is treated as a flat contiguous buffer. The pointer is flattened to ptr<element>, and the multi-dimensional indices are explicitly linearized using statically computed strides. Both load and store operate on this flattened representation
Kindly Review the changes !
https://github.com/llvm/llvm-project/pull/160159
More information about the Mlir-commits
mailing list