[PATCH] D87415: [DAGCombiner] Fold fminnum(X, NaN) to X
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 9 14:56:36 PDT 2020
nikic marked an inline comment as done.
nikic added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:14064
+ // maxnum(X, nan) -> X
+ if (!PropagatesNaN && N1CFP && N1CFP->isNaN())
+ return N->getOperand(0);
----------------
spatel wrote:
> Might as well handle the other pair too (possibly in a follow-up patch)? InstSimplify has:
> // If one argument is NaN, return other or NaN appropriately.
> bool PropagateNaN = IID == Intrinsic::minimum || IID == Intrinsic::maximum;
> if (match(Op0, m_NaN()))
> return PropagateNaN ? Op0 : Op1;
> if (match(Op1, m_NaN()))
> return PropagateNaN ? Op1 : Op0;
>
Good point! I went ahead and directly included it, together with some ARM tests (which conveniently supports both variants).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87415/new/
https://reviews.llvm.org/D87415
More information about the llvm-commits
mailing list