[Mlir-commits] [mlir] [mlir][memref] Fold memref.reinterpret_cast operations with valid offset or size constants. (PR #189533)

Hocky Yudhiono llvmlistbot at llvm.org
Tue Mar 31 00:23:07 PDT 2026


hockyy wrote:

```mlir
module {
  func.func @reinterpret_cast_dynamic_strides_not_contiguous(%arg0: memref<*xf32>, %arg1: index, %arg2: index, %arg3: index, %arg4: index) -> memref<?x?xf32, strided<[?, ?], offset: ?>> {
    %c0 = arith.constant 0 : index
    %reinterpret_cast = memref.reinterpret_cast %arg0 to offset: [%c0], sizes: [%arg1, %arg2], strides: [%arg3, %arg4] : memref<*xf32> to memref<?x?xf32, strided<[?, ?], offset: ?>>
    return %reinterpret_cast : memref<?x?xf32, strided<[?, ?], offset: ?>>
  }
}
```

Try this

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


More information about the Mlir-commits mailing list