forked from OSchip/llvm-project
Simplify this code; use a while instead of an if and a do-while.
llvm-svn: 67400
This commit is contained in:
parent
2460c0c37c
commit
3bdc4bdba6
llvm/lib/CodeGen/SelectionDAG
|
@ -105,18 +105,15 @@ void ScheduleDAGSDNodes::BuildSchedUnits() {
|
||||||
|
|
||||||
// See if anything is flagged to this node, if so, add them to flagged
|
// See if anything is flagged to this node, if so, add them to flagged
|
||||||
// nodes. Nodes can have at most one flag input and one flag output. Flags
|
// nodes. Nodes can have at most one flag input and one flag output. Flags
|
||||||
// are required the be the last operand and result of a node.
|
// are required to be the last operand and result of a node.
|
||||||
|
|
||||||
// Scan up to find flagged preds.
|
// Scan up to find flagged preds.
|
||||||
SDNode *N = NI;
|
SDNode *N = NI;
|
||||||
if (N->getNumOperands() &&
|
while (N->getNumOperands() &&
|
||||||
N->getOperand(N->getNumOperands()-1).getValueType() == MVT::Flag) {
|
N->getOperand(N->getNumOperands()-1).getValueType() == MVT::Flag) {
|
||||||
do {
|
N = N->getOperand(N->getNumOperands()-1).getNode();
|
||||||
N = N->getOperand(N->getNumOperands()-1).getNode();
|
assert(N->getNodeId() == -1 && "Node already inserted!");
|
||||||
assert(N->getNodeId() == -1 && "Node already inserted!");
|
N->setNodeId(NodeSUnit->NodeNum);
|
||||||
N->setNodeId(NodeSUnit->NodeNum);
|
|
||||||
} while (N->getNumOperands() &&
|
|
||||||
N->getOperand(N->getNumOperands()-1).getValueType()== MVT::Flag);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scan down to find any flagged succs.
|
// Scan down to find any flagged succs.
|
||||||
|
|
Loading…
Reference in New Issue