[Mlir-commits] [mlir] [mlir][vector] Add foldInsertUseChain folder function to insert op (PR #147045)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Mon Jul 7 02:19:56 PDT 2025
================
@@ -3446,3 +3446,68 @@ func.func @fold_insert_constant_indices(%arg : vector<4x1xi32>) -> vector<4x1xi3
%res = vector.insert %1, %arg[%0, %0] : i32 into vector<4x1xi32>
return %res : vector<4x1xi32>
}
+
+// -----
+
+// CHECK-LABEL: @fold_insert_use_chain_static_pos(
+// CHECK-SAME: %[[ARG:.*]]: vector<4xf32>,
+// CHECK-SAME: %[[VAL:.*]]: f32) -> vector<4xf32> {
+// CHECK: %[[RES:.*]] = vector.insert %[[VAL]], %[[ARG]] [0] : f32 into vector<4xf32>
+// CHECK: return %[[RES]] : vector<4xf32>
+func.func @fold_insert_use_chain_static_pos(%v : vector<4xf32>, %value : f32) -> vector<4xf32> {
+ %v_0 = vector.insert %value, %v[0] : f32 into vector<4xf32>
+ %v_1 = vector.insert %value, %v_0[0] : f32 into vector<4xf32>
+ %v_2 = vector.insert %value, %v_1[0] : f32 into vector<4xf32>
----------------
banach-space wrote:
It would be good to test a case where different values are inserted.
https://github.com/llvm/llvm-project/pull/147045
More information about the Mlir-commits
mailing list