[Mlir-commits] [mlir] [mlir][vector] Fix crash in ReorderCastOpsOnBroadcast with non-vector result (PR #170985)

Andrzej WarzyƄski llvmlistbot at llvm.org
Mon Dec 8 10:26:41 PST 2025


================
@@ -850,3 +850,20 @@ func.func @negative_store_no_single_use(%arg0: memref<?xf32>, %arg1: index, %arg
   vector.store %0, %arg0[%arg1] : memref<?xf32>, vector<1xf32>
   return %0 : vector<1xf32>
 }
+
+// -----
+
+// CHECK-LABEL: func.func @broadcast_cast_non_vector_result
+// CHECK-SAME: (%[[ARG:.*]]: i64)
+// CHECK: %[[BCAST:.*]] = vector.broadcast %[[ARG]] : i64 to vector<26x7xi64>
+// CHECK: %[[CAST:.*]] = builtin.unrealized_conversion_cast %[[BCAST]] : vector<26x7xi64> to !llvm.array<26 x vector<7xi64>>
+// CHECK: return %[[CAST]] : !llvm.array<26 x vector<7xi64>>
+/// This test ensures that the `ReorderCastOpsOnBroadcast` pattern does not
+/// attempt to reorder a cast operation that produces a non-vector result type.
+/// Previously, this would crash because the pattern assumed the result was a
+/// vector type when creating the new inner broadcast.
----------------
banach-space wrote:

[nit] "Previously" is a very relative term ("previously to what?"). I would just drop this sentence, it doesn't add any new info.

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


More information about the Mlir-commits mailing list