diff options
| author | Michael Berg <michael_c_berg@apple.com> | 2018-06-06 18:47:55 +0000 |
|---|---|---|
| committer | Michael Berg <michael_c_berg@apple.com> | 2018-06-06 18:47:55 +0000 |
| commit | cc1c4b691230de5ed85fff9e2578367580407d6b (patch) | |
| tree | c9e239d298135d2781bb8c09bf8a30c76b869d34 /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | |
| parent | 11c99ed05f7a5046c924126c1abcf9334a172bbc (diff) | |
| download | bcm5719-llvm-cc1c4b691230de5ed85fff9e2578367580407d6b.tar.gz bcm5719-llvm-cc1c4b691230de5ed85fff9e2578367580407d6b.zip | |
guard fsqrt with fmf sub flags
Summary:
This change uses fmf subflags to guard optimizations as well as unsafe. These changes originated from D46483.
It contains only context for fsqrt.
Reviewers: spatel, hfinkel, arsenm
Reviewed By: spatel
Subscribers: hfinkel, wdng, andrew.w.kaylor, wristow, efriedma, nemanjai
Differential Revision: https://reviews.llvm.org/D47749
llvm-svn: 334113
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 50953275d33..6d59f330048 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -10893,17 +10893,16 @@ SDValue DAGCombiner::visitFREM(SDNode *N) { } SDValue DAGCombiner::visitFSQRT(SDNode *N) { - if (!DAG.getTarget().Options.UnsafeFPMath) + SDNodeFlags Flags = N->getFlags(); + if (!DAG.getTarget().Options.UnsafeFPMath && + !Flags.hasApproximateFuncs()) return SDValue(); SDValue N0 = N->getOperand(0); if (TLI.isFsqrtCheap(N0, DAG)) return SDValue(); - // TODO: FSQRT nodes should have flags that propagate to the created nodes. - // For now, create a Flags object for use with reassociation math transforms. - SDNodeFlags Flags; - Flags.setAllowReassociation(true); + // FSQRT nodes have flags that propagate to the created nodes. return buildSqrtEstimate(N0, Flags); } |

