[Mlir-commits] [mlir] [vector][mlir] Canonicalize to shape_cast where possible (PR #140583)

James Newling llvmlistbot at llvm.org
Wed Jun 25 16:50:49 PDT 2025


================
@@ -480,11 +480,11 @@ func.func @lift_illegal_transpose_to_memory_with_in_bounds_attr(%a: index, %b: i
 
 // -----
 
-// The pass should do nothing (and not crash).
-// CHECK-LABEL: @illegal_transpose_no_defining_source_op
-func.func @illegal_transpose_no_defining_source_op(%vec: vector<[4]x1xf32>) -> vector<1x[4]xf32>
+// CHECK-LABEL: @transpose_no_defining_source_op
+func.func @transpose_no_defining_source_op(%vec: vector<[4]x1xf32>) -> vector<1x[4]xf32>
 {
-  // CHECK: vector.transpose
+  // CHECK:      vector.shape_cast
+  // CHECK-SAME: vector<[4]x1xf32> to vector<1x[4]xf32>
----------------
newling wrote:

@banach-space I'm getting back to this PR. Peephole question: is this operation ok? i.e. is 

```
vector.shape_cast %a vector<[4]x1xf32> to vector<1x[4]xf32>
```
an acceptable operation to have after running `mlir-opt  -arm-sme-vector-legalization -cse -canonicalize` ?

 

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


More information about the Mlir-commits mailing list