[PATCH] D87415: [DAGCombiner] Fold fminnum(X, NaN) to X
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 9 14:37:06 PDT 2020
spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.
LGTM - I'll update the other patch after this lands.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:14064
+ // maxnum(X, nan) -> X
+ if (!PropagatesNaN && N1CFP && N1CFP->isNaN())
+ return N->getOperand(0);
----------------
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;
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