diff options
author | Michael Berg <michael_c_berg@apple.com> | 2018-06-12 16:13:11 +0000 |
---|---|---|
committer | Michael Berg <michael_c_berg@apple.com> | 2018-06-12 16:13:11 +0000 |
commit | 5d49f665704523fece06d9621b3deeb5dc4b44e6 (patch) | |
tree | 47c439fd6849c2565fa7ae60c32d7dcd28f27b46 /llvm/lib | |
parent | e39fa6cbbb368df3f8365a4d2311b079de921dd7 (diff) | |
download | bcm5719-llvm-5d49f665704523fece06d9621b3deeb5dc4b44e6.tar.gz bcm5719-llvm-5d49f665704523fece06d9621b3deeb5dc4b44e6.zip |
Utilize new SDNode flag functionality to expand current support for fmul
Summary: This patch originated from D46562 and is a proper subset, with some issues addressed for fmul.
Reviewers: spatel, hfinkel, wristow, arsenm
Reviewed By: spatel
Subscribers: nhaehnle, wdng
Differential Revision: https://reviews.llvm.org/D47911
llvm-svn: 334514
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index da46a847490..0956cb519ef 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -10542,12 +10542,15 @@ SDValue DAGCombiner::visitFMUL(SDNode *N) { if (SDValue NewSel = foldBinOpIntoSelect(N)) return NewSel; - if (Options.UnsafeFPMath) { + if (Options.UnsafeFPMath || + (Flags.hasNoNaNs() && Flags.hasNoSignedZeros())) { // fold (fmul A, 0) -> 0 if (N1CFP && N1CFP->isZero()) return N1; + } - // fmul (fmul X, C1), X2 -> fmul X, C1 * C2 + if (Options.UnsafeFPMath || Flags.hasAllowReassociation()) { + // fmul (fmul X, C1), C2 -> fmul X, C1 * C2 if (N0.getOpcode() == ISD::FMUL) { // Fold scalars or any vector constants (not just splats). // This fold is done in general by InstCombine, but extra fmul insts |