SelectionDAG: slightly refactor DAGCombiner::visitSELECT_CC to avoid redudant checks...

This doesn't really effect performance due to all the relevant calls being transparent but is clearer. 

llvm-svn: 184027
This commit is contained in:
Stephen Lin 2013-06-15 04:03:33 +00:00
parent 2dbebcfede
commit 605207fe75
1 changed files with 14 additions and 12 deletions

View File

@ -4233,9 +4233,10 @@ SDValue DAGCombiner::visitSELECT_CC(SDNode *N) {
// Determine if the condition we're dealing with is constant
SDValue SCC = SimplifySetCC(getSetCCResultType(N0.getValueType()),
N0, N1, CC, SDLoc(N), false);
if (SCC.getNode()) AddToWorkList(SCC.getNode());
if (SCC.getNode()) {
AddToWorkList(SCC.getNode());
if (ConstantSDNode *SCCC = dyn_cast_or_null<ConstantSDNode>(SCC.getNode())) {
if (ConstantSDNode *SCCC = dyn_cast<ConstantSDNode>(SCC.getNode())) {
if (!SCCC->isNullValue())
return N2; // cond always true -> true val
else
@ -4243,10 +4244,11 @@ SDValue DAGCombiner::visitSELECT_CC(SDNode *N) {
}
// Fold to a simpler select_cc
if (SCC.getNode() && SCC.getOpcode() == ISD::SETCC)
if (SCC.getOpcode() == ISD::SETCC)
return DAG.getNode(ISD::SELECT_CC, SDLoc(N), N2.getValueType(),
SCC.getOperand(0), SCC.getOperand(1), N2, N3,
SCC.getOperand(2));
}
// If we can fold this based on the true/false value, do so.
if (SimplifySelectOps(N, N2, N3))