summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff options
context:
space:
mode:
authorMichael Berg <michael_c_berg@apple.com>2019-01-28 18:03:08 +0000
committerMichael Berg <michael_c_berg@apple.com>2019-01-28 18:03:08 +0000
commit685d5f675e23bc991ad8a96739ff0833bdd23c15 (patch)
treebeccfc045b40f884c1c5b0c841b8a9ac94868418 /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
parent8f7fc95ab7aab395ec06affa8c705eee2432fcdc (diff)
downloadbcm5719-llvm-685d5f675e23bc991ad8a96739ff0833bdd23c15.tar.gz
bcm5719-llvm-685d5f675e23bc991ad8a96739ff0833bdd23c15.zip
[NFC] TLI query with default(on) behavior wrt DAG combines for fmin/fmax target control
llvm-svn: 352396
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 97b21e108ea..871c8ddb8f1 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -7206,11 +7206,14 @@ SDValue DAGCombiner::visitCTPOP(SDNode *N) {
// FIXME: This should be checking for no signed zeros on individual operands, as
// well as no nans.
-static bool isLegalToCombineMinNumMaxNum(SelectionDAG &DAG, SDValue LHS, SDValue RHS) {
+static bool isLegalToCombineMinNumMaxNum(SelectionDAG &DAG, SDValue LHS,
+ SDValue RHS,
+ const TargetLowering &TLI) {
const TargetOptions &Options = DAG.getTarget().Options;
EVT VT = LHS.getValueType();
return Options.NoSignedZerosFPMath && VT.isFloatingPoint() &&
+ TLI.isProfitableToCombineMinNumMaxNum(VT) &&
DAG.isKnownNeverNaN(LHS) && DAG.isKnownNeverNaN(RHS);
}
@@ -7480,7 +7483,7 @@ SDValue DAGCombiner::visitSELECT(SDNode *N) {
// select (fcmp gt x, y), x, y -> fmaxnum x, y
//
// This is OK if we don't care what happens if either operand is a NaN.
- if (N0.hasOneUse() && isLegalToCombineMinNumMaxNum(DAG, N1, N2))
+ if (N0.hasOneUse() && isLegalToCombineMinNumMaxNum(DAG, N1, N2, TLI))
if (SDValue FMinMax = combineMinNumMaxNum(DL, VT, Cond0, Cond1, N1, N2,
CC, TLI, DAG))
return FMinMax;
@@ -7987,7 +7990,8 @@ SDValue DAGCombiner::visitVSELECT(SDNode *N) {
// NaN.
//
EVT VT = N->getValueType(0);
- if (N0.hasOneUse() && isLegalToCombineMinNumMaxNum(DAG, N0.getOperand(0), N0.getOperand(1))) {
+ if (N0.hasOneUse() && isLegalToCombineMinNumMaxNum(
+ DAG, N0.getOperand(0), N0.getOperand(1), TLI)) {
ISD::CondCode CC = cast<CondCodeSDNode>(N0.getOperand(2))->get();
if (SDValue FMinMax = combineMinNumMaxNum(
DL, VT, N0.getOperand(0), N0.getOperand(1), N1, N2, CC, TLI, DAG))
OpenPOWER on IntegriCloud