[Mlir-commits] [mlir] [mlir][arith] Fix arith maxnumf/minnumf folder (PR #114595)
Clément Fournier
llvmlistbot at llvm.org
Mon Nov 4 08:08:15 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();
- return constFoldBinaryOp<FloatAttr>(
- adaptor.getOperands(),
- [](const APFloat &a, const APFloat &b) { return llvm::maximum(a, b); });
+ return constFoldBinaryOp<FloatAttr>(adaptor.getOperands(),
+ [](const APFloat &a, const APFloat &b) {
+ return llvm::maximumnum(a, b);
+ });
----------------
oowekyala wrote:
Yes I think that would work. Should I update other similar lambdas in the fold implementations?
https://github.com/llvm/llvm-project/pull/114595
More information about the Mlir-commits
mailing list