[Mlir-commits] [mlir] [mlir][arith] Fix arith maxnumf/minnumf folder (PR #114595)

Clément Fournier llvmlistbot at llvm.org
Mon Nov 4 08:12:49 PST 2024


================
@@ -1014,13 +1014,14 @@ OpFoldResult arith::MaxNumFOp::fold(FoldAdaptor adaptor) {
   if (getLhs() == getRhs())
     return getRhs();
 
-  // maxnumf(x, -inf) -> x
-  if (matchPattern(adaptor.getRhs(), m_NegInfFloat()))
+  // maxnumf(x, NaN) -> x
+  if (matchPattern(adaptor.getRhs(), m_NaNFloat()))
     return getLhs();
----------------
oowekyala wrote:

To check that `x` is not NaN you need to have folded `x` to some constant. This is handled by the last pattern below, which computes the result of the operation if both operands are folded.

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


More information about the Mlir-commits mailing list