[Mlir-commits] [mlir] [mlir][vector] Fix fold result for empty vector.mask with no results (PR #180345)
Longsheng Mou
llvmlistbot at llvm.org
Thu Feb 12 06:32:07 PST 2026
================
@@ -772,3 +772,14 @@ func.func @arith_truncf(%arg0: f64) -> f16 {
return %truncd1 : f16
}
+
+// -----
+
+// Ensure that vector.mask with an empty mask does not cause issues.
+
+// CHECK-LABEL: empty_vector_mask
+func.func @empty_vector_mask(%mask : vector<8xi1>) {
+ // CHECK: vector.mask
+ vector.mask %mask { vector.yield } : vector<8xi1>
+ return
+}
----------------
CoTinker wrote:
Actually, there are already a test in test/Vector/canonicalize.mlir:
https://github.com/llvm/llvm-project/blob/6da74dded02d9fc06fab99fc8fb99a3e6a1f21c3/mlir/test/Dialect/Vector/canonicalize.mlir#L3090-L3094
I added this test case in arith-to-emitc.mlir to test the tryFold function invoked during conversion.
https://github.com/llvm/llvm-project/blob/6da74dded02d9fc06fab99fc8fb99a3e6a1f21c3/mlir/lib/IR/Builders.cpp#L499-L504
https://github.com/llvm/llvm-project/pull/180345
More information about the Mlir-commits
mailing list