[Mlir-commits] [mlir] [MLIR] [Vector] Added canonicalizer for folding from_elements + transpose (PR #161841)

Andrzej WarzyƄski llvmlistbot at llvm.org
Thu Oct 16 06:49:48 PDT 2025


================
@@ -308,6 +308,18 @@ func.func @constant_mask_transpose_to_transposed_constant_mask() -> (vector<2x3x
 
 // -----
 
+// CHECK-LABEL: transpose_from_elements_2d
+func.func @transpose_from_elements_2d(%a0: i32, %a1: i32, %a2: i32,
+                                      %a3: i32, %a4: i32, %a5: i32) -> vector<3x2xi32> {
+  %v = vector.from_elements %a0, %a1, %a2, %a3, %a4, %a5 : vector<2x3xi32>
+  %t = vector.transpose %v, [1, 0] : vector<2x3xi32> to vector<3x2xi32>
+  return %t : vector<3x2xi32>
+  // CHECK: %[[R:.*]] = vector.from_elements %arg0, %arg3, %arg1, %arg4, %arg2, %arg5 : vector<3x2xi32>
----------------
banach-space wrote:

This comment has not been resolved, so "unresolved".

In case this was not clear, we shouldn't rely on "actual" variable names (e.g. `%arg0`) in FileCheck `CHECK` lines - these can change in the future. Instead, please use FileCheck variables (e.g. `%[[ARG0:.*]]` or similar).

Similar comment for other tests.

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


More information about the Mlir-commits mailing list