[Mlir-commits] [mlir] [mlir][linalg] Emit proper diagnostic instead of crashing in SelectOp with index type (PR #183652)
Renato Golin
llvmlistbot at llvm.org
Fri Mar 6 10:22:10 PST 2026
================
@@ -2172,3 +2172,15 @@ func.func @matmul_invalid_mixed_types(%t: tensor<?xf16>, %f: vector<4xf16>)
outs(%f : vector<4xf16>) -> tensor<?xf16>
func.return %0, %f : tensor<?xf16>, vector<4xf16>
}
+
+// -----
+
+// Regression test: linalg.select with index type operands should emit a
+// diagnostic instead of crashing (https://github.com/llvm/llvm-project/issues/179046).
+func.func @select_invalid_index_type(%cond: index, %a: index, %b: index,
+ %out: tensor<1xindex>) -> tensor<1xindex> {
+ // expected-error @below {{unsupported non numeric type}}
+ %0 = linalg.select ins(%cond, %a, %b : index, index, index)
+ outs(%out : tensor<1xindex>) -> tensor<1xindex>
+ return %0 : tensor<1xindex>
+}
----------------
rengolin wrote:
Yes, this deserves four tests:
* Non boolean on arg0 (keep other types correct)
* arg1 is of different type than return
* arg2 is of different type than return
* both arg1 and arg2 are of different types than return
https://github.com/llvm/llvm-project/pull/183652
More information about the Mlir-commits
mailing list