[Mlir-commits] [mlir] [mlir][Vector] add vector.insert canonicalization pattern for vectors created from ub.poison (PR #142944)

Yang Bai llvmlistbot at llvm.org
Thu Jul 31 00:22:46 PDT 2025


================
@@ -2320,6 +2320,44 @@ func.func @insert_2d_constant() -> (vector<2x3xi32>, vector<2x3xi32>, vector<2x3
 
 // -----
 
+// CHECK-LABEL: func.func @fully_insert_scalar_to_vector(
+//  CHECK-SAME: %[[ARG0:.+]]: vector<2xi64>)
+//       CHECK: %[[CST10:.+]] = arith.constant 10 : i64
+//       CHECK: %[[CST20:.+]] = arith.constant 20 : i64
+//       CHECK: %[[RES:.+]] = vector.from_elements %[[CST10]], %[[CST20]] : vector<2xi64>
+//  CHECK-NEXT: return %[[RES]]
+func.func @fully_insert_scalar_to_vector(%arg0 : vector<2xi64>) -> vector<2xi64> {
+  %c0 = arith.constant 0 : index
+  %c1 = arith.constant 1 : index
+  %e0 = arith.constant 10 : i64
+  %e1 = arith.constant 20 : i64
----------------
yangtetris wrote:

Good point. Will update in the next commit.

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


More information about the Mlir-commits mailing list