diff options
author | Michael Berg <michael_c_berg@apple.com> | 2018-06-05 18:49:47 +0000 |
---|---|---|
committer | Michael Berg <michael_c_berg@apple.com> | 2018-06-05 18:49:47 +0000 |
commit | 96925fe0df7a628839eabb5886a0e59910713ab6 (patch) | |
tree | 400aafdcd23c4192db8cca373fe9e5189186b1e2 /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | b89704fa6f6fc80c58bdacdadeb6d0dd4fa6e5d9 (diff) | |
download | bcm5719-llvm-96925fe0df7a628839eabb5886a0e59910713ab6.tar.gz bcm5719-llvm-96925fe0df7a628839eabb5886a0e59910713ab6.zip |
guard fneg with fmf sub flags
Summary: This change uses fmf subflags to guard optimizations as well as unsafe. These changes originated from D46483.
Reviewers: spatel, hfinkel
Reviewed By: spatel
Subscribers: nemanjai
Differential Revision: https://reviews.llvm.org/D47389
llvm-svn: 334037
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 9dac51f33cd..bdecb8b37c4 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -4049,10 +4049,10 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, EVT VT, break; case ISD::FNEG: // -(X-Y) -> (Y-X) is unsafe because when X==Y, -0.0 != +0.0 - if (getTarget().Options.UnsafeFPMath && OpOpcode == ISD::FSUB) - // FIXME: FNEG has no fast-math-flags to propagate; use the FSUB's flags? + if ((getTarget().Options.UnsafeFPMath || Flags.hasNoSignedZeros()) && + OpOpcode == ISD::FSUB) return getNode(ISD::FSUB, DL, VT, Operand.getOperand(1), - Operand.getOperand(0), Operand.getNode()->getFlags()); + Operand.getOperand(0), Flags); if (OpOpcode == ISD::FNEG) // --X -> X return Operand.getOperand(0); break; |