[Mlir-commits] [mlir] [MLIR][Arith] SelectOp fix invalid folding (PR #117555)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Nov 25 07:22:56 PST 2024


================
@@ -2314,7 +2314,8 @@ OpFoldResult arith::SelectOp::fold(FoldAdaptor adaptor) {
     return trueVal;
 
   // select %x, true, false => %x
-  if (getType().isInteger(1) && matchPattern(adaptor.getTrueValue(), m_One()) &&
+  if (getType().isSignlessInteger(1) &&
----------------
7FM wrote:

AFAIK, `arith.select` does only allow signless types for the condition type. At least simply changing `%sel` from `i1` to `ui1` throws the following `error: use of value '%sel' expects different type than prior uses: 'i1' vs 'ui1'`.
But I agree, in case that this limitation will be lifted at some day, comparing the type directly would be better.

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


More information about the Mlir-commits mailing list