diff options
author | Michael Berg <michael_c_berg@apple.com> | 2019-06-03 19:12:15 +0000 |
---|---|---|
committer | Michael Berg <michael_c_berg@apple.com> | 2019-06-03 19:12:15 +0000 |
commit | 0b7f98da6569bbc49aed2675fdda95f89198d356 (patch) | |
tree | 9093b96034a6cce49ce0f14190746d5badeca025 /llvm/lib/CodeGen | |
parent | bad43d8f49cc3efc2751f11c795c0ad7b3fc3975 (diff) | |
download | bcm5719-llvm-0b7f98da6569bbc49aed2675fdda95f89198d356.tar.gz bcm5719-llvm-0b7f98da6569bbc49aed2675fdda95f89198d356.zip |
Propagate fmf for setcc/select folds
Summary: This change facilitates propagating fmf which was placed on setcc from fcmp through folds with selects so that back ends can model this path for arithmetic folds on selects in SDAG.
Reviewers: qcolombet, spatel
Reviewed By: qcolombet
Subscribers: nemanjai, jsji
Differential Revision: https://reviews.llvm.org/D62552
llvm-svn: 362439
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index a4c1e9886ae..98e7f4055e9 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -7941,9 +7941,16 @@ SDValue DAGCombiner::visitSELECT(SDNode *N) { } if (TLI.isOperationLegal(ISD::SELECT_CC, VT) || - (!LegalOperations && TLI.isOperationLegalOrCustom(ISD::SELECT_CC, VT))) - return DAG.getNode(ISD::SELECT_CC, DL, VT, Cond0, Cond1, N1, N2, - N0.getOperand(2)); + (!LegalOperations && + TLI.isOperationLegalOrCustom(ISD::SELECT_CC, VT))) { + // Any flags available in a select/setcc fold will be on the setcc as they + // migrated from fcmp + const SDNodeFlags Flags = N0.getNode()->getFlags(); + SDValue SelectNode = DAG.getNode(ISD::SELECT_CC, DL, VT, Cond0, Cond1, N1, + N2, N0.getOperand(2)); + SelectNode->setFlags(Flags); + return SelectNode; + } return SimplifySelect(DL, N0, N1, N2); } |