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

Jakub Kuderski llvmlistbot at llvm.org
Mon Nov 25 06:53:50 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) &&
+      matchPattern(adaptor.getTrueValue(), m_One()) &&
       matchPattern(adaptor.getFalseValue(), m_Zero()))
     return condition;
----------------
kuhar wrote:

I think we could also have a canon pattern that can broadcast the condition in the vector case, but that's probably better for a separate PR.

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


More information about the Mlir-commits mailing list