[Mlir-commits] [mlir] [MLIR][Canonicalization] Add shape_cast folding patterns (PR #183061)
Alexandra Sidorova
llvmlistbot at llvm.org
Mon Mar 2 21:04:57 PST 2026
================
@@ -1078,6 +1078,19 @@ func.func @dont_fold_expand_collapse(%arg0: vector<1x1x64xf32>) -> vector<8x8xf3
// -----
+// CHECK-LABEL: func.func @fold_shape_cast_from_elements(
+// CHECK-SAME: %[[C1:.*]]: f32, %[[C2:.*]]: f32, %[[C3:.*]]: f32, %[[C4:.*]]: f32
+func.func @fold_shape_cast_from_elements(%c1: f32, %c2: f32, %c3: f32, %c4: f32) -> vector<2x2xf32>{
+// CHECK: %[[VAL_0:.*]] = vector.from_elements %[[C1]], %[[C2]], %[[C3]], %[[C4]] : vector<2x2xf32>
+// CHECK: return %[[VAL_0]] : vector<2x2xf32>
+// CHECK-NOT: vector.shape_cast
----------------
a-sidorova wrote:
> [nit] Other tests in this file seem to keep CHECK lines above the test function.
I've double checked - I'd say that some tests in this file have the same CHECK line style as new added tests, other tests - have the proposed your style. I'm not sure that it worth to change style of new test. Probably it makes sense to align the style of entire file - but perhaps it should be the separate activity if needed.
Thanks!
https://github.com/llvm/llvm-project/pull/183061
More information about the Mlir-commits
mailing list