[Mlir-commits] [mlir] [mlir] Compose expand of collapse to cast (PR #172864)

Matthias Springer llvmlistbot at llvm.org
Thu Dec 18 07:30:16 PST 2025


================
@@ -1193,6 +1193,25 @@ func.func @collapse_expand_fold_to_cast(%m: memref<?xf32, strided<[1]>, 3>, %sz0
 
 // -----
 
+// CHECK-LABEL: func @expand_collapse_fold_to_cast(
+//  CHECK-SAME:     %[[m:.*]]: memref<1x1x384x384xui8, strided<[1179648, 147456, 384, 1]>>
+//       CHECK:   %[[casted:.*]] = memref.cast %[[m]] : memref<1x1x384x384xui8, strided<[1179648, 147456, 384, 1]>> to memref<1x1x384x384xui8, strided<[1179648, 1179648, 384, 1]>>
----------------
matthias-springer wrote:

I'm not sure if it's desirable to fold expand_shape(collapse_shape(x)) into cast(x). I believe these operations were introduced because "cast" does not carry enough semantic information. @Groverkss @MaheshRavishankar may know better

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


More information about the Mlir-commits mailing list