[Mlir-commits] [mlir] [mlir][memref] Canonicalize memref.reinterpret_cast when offset/sizes/strides are constants. (PR #163505)

Valentin Clement バレンタイン クレメン llvmlistbot at llvm.org
Fri Oct 17 15:11:16 PDT 2025


clementval wrote:

This test is not triggering the verifier before the canonicalization pattern but after it does. Should the verifier be stricter or should the pattern fails on such op? 

```
func.func @reinterpret_constant_fold2(%arg0: memref<?x?x?xi32>, %arg1 : index) -> memref<?x?x?xi32, strided<[?, ?, ?], offset: ?>> {
  %c0 = arith.constant 0 : index
  %c-1 = arith.constant -1 : index
  %reinterpret_cast = memref.reinterpret_cast %arg0 to offset: [%c0], sizes: [%arg1, %arg1, %c-1], strides: [%arg1, %arg1, %arg1] : memref<?x?x?xi32> to memref<?x?x?xi32, strided<[?, ?, ?], offset: ?>>
  return %reinterpret_cast : memref<?x?x?xi32, strided<[?, ?, ?], offset: ?>>
}
```

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


More information about the Mlir-commits mailing list