[Mlir-commits] [mlir] [mlir][Vector] Improve `vector.mask` verifier (PR #139823)

Diego Caballero llvmlistbot at llvm.org
Wed May 14 10:56:30 PDT 2025


================
@@ -1747,6 +1747,34 @@ func.func @vector_mask_0d_mask(%arg0: tensor<2x4xi32>,
 
 // -----
 
+func.func @vector_mask_non_empty_external_return(%t0: tensor<?xf32>, %idx: index,
+                                                 %m0: vector<16xi1>, %ext: vector<16xf32>) -> vector<16xf32> {
+  %ft0 = arith.constant 0.0 : f32
+  // expected-error at +1 {{'vector.mask' op expects all the results from the MaskableOpInterface to be returned by the terminator}}
+  %0 = vector.mask %m0 {
+    %1 =vector.transfer_read %t0[%idx], %ft0 : tensor<?xf32>, vector<16xf32>
+    vector.yield %ext : vector<16xf32>
+  } : vector<16xi1> -> vector<16xf32>
+
+  return %0 : vector<16xf32>
+}
+
+// -----
+
+func.func @vector_mask_non_empty_mixed_return(%t0: tensor<?xf32>, %idx: index,
+                                              %m0: vector<16xi1>, %ext: vector<16xf32>) -> (vector<16xf32>, vector<16xf32>) {
+  %ft0 = arith.constant 0.0 : f32
+  // expected-error at +1 {{'vector.mask' op expects number of results to match maskable operation number of results}}
----------------
dcaballe wrote:

The original code in `ensureTerminator` was replacing the explicitly-provided terminator for a different one.

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


More information about the Mlir-commits mailing list