[Mlir-commits] [mlir] [mlir][arith] Fix arith maxnumf/minnumf folder (PR #114595)
Jakub Kuderski
llvmlistbot at llvm.org
Mon Nov 4 08:12:35 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);
+ });
----------------
kuhar wrote:
In general, I'd only update the code that relevant to this PR, and submit any other cleanups as a separate PR
https://github.com/llvm/llvm-project/pull/114595
More information about the Mlir-commits
mailing list