Skip to content

Commit 5c2054a

Browse files
authored
[DAG] getMinMaxOpcodeForFP - split if-else chain. NFC. (#151938)
(style) All cases return so split the chain
1 parent 25c02fb commit 5c2054a

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6499,19 +6499,21 @@ static unsigned getMinMaxOpcodeForFP(SDValue Operand1, SDValue Operand2,
64996499
// It is safe to use FMINNUM_IEEE/FMAXNUM_IEEE if all the operands
65006500
// are non NaN values.
65016501
if (((CC == ISD::SETLT || CC == ISD::SETLE) && (OrAndOpcode == ISD::OR)) ||
6502-
((CC == ISD::SETGT || CC == ISD::SETGE) && (OrAndOpcode == ISD::AND)))
6502+
((CC == ISD::SETGT || CC == ISD::SETGE) && (OrAndOpcode == ISD::AND))) {
65036503
return arebothOperandsNotNan(Operand1, Operand2, DAG) &&
65046504
isFMAXNUMFMINNUM_IEEE
65056505
? ISD::FMINNUM_IEEE
65066506
: ISD::DELETED_NODE;
6507-
else if (((CC == ISD::SETGT || CC == ISD::SETGE) &&
6508-
(OrAndOpcode == ISD::OR)) ||
6509-
((CC == ISD::SETLT || CC == ISD::SETLE) &&
6510-
(OrAndOpcode == ISD::AND)))
6507+
}
6508+
6509+
if (((CC == ISD::SETGT || CC == ISD::SETGE) && (OrAndOpcode == ISD::OR)) ||
6510+
((CC == ISD::SETLT || CC == ISD::SETLE) && (OrAndOpcode == ISD::AND))) {
65116511
return arebothOperandsNotNan(Operand1, Operand2, DAG) &&
65126512
isFMAXNUMFMINNUM_IEEE
65136513
? ISD::FMAXNUM_IEEE
65146514
: ISD::DELETED_NODE;
6515+
}
6516+
65156517
// Both FMINNUM/FMAXNUM and FMINNUM_IEEE/FMAXNUM_IEEE handle quiet
65166518
// NaNs in the same way. But, FMINNUM/FMAXNUM and FMINNUM_IEEE/
65176519
// FMAXNUM_IEEE handle signaling NaNs differently. If we cannot prove
@@ -6521,24 +6523,24 @@ static unsigned getMinMaxOpcodeForFP(SDValue Operand1, SDValue Operand2,
65216523
// we can prove that we do not have any sNaNs, then we can do the
65226524
// optimization using FMINNUM_IEEE/FMAXNUM_IEEE for the following
65236525
// cases.
6524-
else if (((CC == ISD::SETOLT || CC == ISD::SETOLE) &&
6525-
(OrAndOpcode == ISD::OR)) ||
6526-
((CC == ISD::SETUGT || CC == ISD::SETUGE) &&
6527-
(OrAndOpcode == ISD::AND)))
6526+
if (((CC == ISD::SETOLT || CC == ISD::SETOLE) && (OrAndOpcode == ISD::OR)) ||
6527+
((CC == ISD::SETUGT || CC == ISD::SETUGE) && (OrAndOpcode == ISD::AND))) {
65286528
return isFMAXNUMFMINNUM ? ISD::FMINNUM
6529-
: arebothOperandsNotSNan(Operand1, Operand2, DAG) &&
6530-
isFMAXNUMFMINNUM_IEEE
6531-
? ISD::FMINNUM_IEEE
6532-
: ISD::DELETED_NODE;
6533-
else if (((CC == ISD::SETOGT || CC == ISD::SETOGE) &&
6534-
(OrAndOpcode == ISD::OR)) ||
6535-
((CC == ISD::SETULT || CC == ISD::SETULE) &&
6536-
(OrAndOpcode == ISD::AND)))
6529+
: arebothOperandsNotSNan(Operand1, Operand2, DAG) &&
6530+
isFMAXNUMFMINNUM_IEEE
6531+
? ISD::FMINNUM_IEEE
6532+
: ISD::DELETED_NODE;
6533+
}
6534+
6535+
if (((CC == ISD::SETOGT || CC == ISD::SETOGE) && (OrAndOpcode == ISD::OR)) ||
6536+
((CC == ISD::SETULT || CC == ISD::SETULE) && (OrAndOpcode == ISD::AND))) {
65376537
return isFMAXNUMFMINNUM ? ISD::FMAXNUM
6538-
: arebothOperandsNotSNan(Operand1, Operand2, DAG) &&
6539-
isFMAXNUMFMINNUM_IEEE
6540-
? ISD::FMAXNUM_IEEE
6541-
: ISD::DELETED_NODE;
6538+
: arebothOperandsNotSNan(Operand1, Operand2, DAG) &&
6539+
isFMAXNUMFMINNUM_IEEE
6540+
? ISD::FMAXNUM_IEEE
6541+
: ISD::DELETED_NODE;
6542+
}
6543+
65426544
return ISD::DELETED_NODE;
65436545
}
65446546

0 commit comments

Comments
 (0)