[Mlir-commits] [mlir] [mlir][vector]add extractInsertFoldConstantOp fold function and apply it to extractOp and insertOp. (PR #124399)

Andrzej WarzyƄski llvmlistbot at llvm.org
Mon Feb 3 09:20:10 PST 2025


================
@@ -3042,3 +3042,33 @@ func.func @contiguous_scatter_step(%base: memref<?xf32>,
     memref<?xf32>, vector<16xindex>, vector<16xi1>, vector<16xf32>
   return
 }
+
+// -----
+
+// CHECK-LABEL: func @fold_extract_constant_indices
+
+func.func @fold_extract_constant_indices(%arg : vector<32x1xi32>) -> i32 {
+  %0 = arith.constant 0 : index
+  %1 = vector.extract %arg[%0, %0] : i32 from vector<32x1xi32>
+  return %1 : i32
+}
+
+// CHECK-SAME:  %[[ARG:.*]]: vector<32x1xi32>) -> i32 {
----------------
banach-space wrote:

Move next to `CHECK-LABEL` to maintain consistency within the file:
* https://github.com/llvm/llvm-project/blob/978310f1de712fc9092142f0985a541a537f21ec/mlir/test/Dialect/Vector/canonicalize.mlir#L69-L70

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


More information about the Mlir-commits mailing list