[Mlir-commits] [mlir] [mlir][vector] shape_cast(broadcast) -> broadcast canonicalization (PR #134939)

Andrzej WarzyƄski llvmlistbot at llvm.org
Wed Apr 9 02:01:36 PDT 2025


================
@@ -1017,6 +1017,31 @@ func.func @canonicalize_broadcast_shapecast_to_shapecast(%arg0: vector<3x4xf32>)
 
 // -----
 
+
+// CHECK-LABEL: func @canonicalize_broadcast_shapecast_scalar
+//       CHECK:   vector.broadcast
+//  CHECK-SAME:   f32 to vector<3x4x1xf32>
+//   CHECK-NOT:   vector.shape_cast
+func.func @canonicalize_broadcast_shapecast_scalar(%arg0: f32) -> vector<3x4x1xf32> {
----------------
banach-space wrote:

[nit] How about more descriptive names: `@canonicalize_broadcast_shapecast_to_broadcast_scalar`. Similar comment for the other test.

Also, would you mind making sure tests for `ShapeCastBroadcastFolder` are clustered into two groups:
* shape_cast(broadcast) -> broadcast
* shape_cast(broadcast) -> shape_cast

? Thanks!

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


More information about the Mlir-commits mailing list