mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-08 03:30:22 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184027 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
702ff96ff3
commit
7e6d620336
@ -4233,21 +4233,23 @@ SDValue DAGCombiner::visitSELECT_CC(SDNode *N) {
|
|||||||
// Determine if the condition we're dealing with is constant
|
// Determine if the condition we're dealing with is constant
|
||||||
SDValue SCC = SimplifySetCC(getSetCCResultType(N0.getValueType()),
|
SDValue SCC = SimplifySetCC(getSetCCResultType(N0.getValueType()),
|
||||||
N0, N1, CC, SDLoc(N), false);
|
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())
|
if (!SCCC->isNullValue())
|
||||||
return N2; // cond always true -> true val
|
return N2; // cond always true -> true val
|
||||||
else
|
else
|
||||||
return N3; // cond always false -> false val
|
return N3; // cond always false -> false val
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fold to a simpler select_cc
|
||||||
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fold to a simpler select_cc
|
|
||||||
if (SCC.getNode() && 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 we can fold this based on the true/false value, do so.
|
||||||
if (SimplifySelectOps(N, N2, N3))
|
if (SimplifySelectOps(N, N2, N3))
|
||||||
return SDValue(N, 0); // Don't revisit N.
|
return SDValue(N, 0); // Don't revisit N.
|
||||||
|
Loading…
Reference in New Issue
Block a user