Simplify this code; use a while instead of an if and a do-while.
authorDan Gohman <gohman@apple.com>
Fri, 20 Mar 2009 20:42:23 +0000 (20:42 +0000)
committerDan Gohman <gohman@apple.com>
Fri, 20 Mar 2009 20:42:23 +0000 (20:42 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67400 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp

index ea9f47bf3185ed73e2ed95e27e165948e7f5d3be..967a8cef8e15d525f7b28d0be5a24206d041c643 100644 (file)
@@ -105,18 +105,15 @@ void ScheduleDAGSDNodes::BuildSchedUnits() {
     
     // 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
-    // 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.
     SDNode *N = NI;
-    if (N->getNumOperands() &&
-        N->getOperand(N->getNumOperands()-1).getValueType() == MVT::Flag) {
-      do {
-        N = N->getOperand(N->getNumOperands()-1).getNode();
-        assert(N->getNodeId() == -1 && "Node already inserted!");
-        N->setNodeId(NodeSUnit->NodeNum);
-      } while (N->getNumOperands() &&
-               N->getOperand(N->getNumOperands()-1).getValueType()== MVT::Flag);
+    while (N->getNumOperands() &&
+           N->getOperand(N->getNumOperands()-1).getValueType() == MVT::Flag) {
+      N = N->getOperand(N->getNumOperands()-1).getNode();
+      assert(N->getNodeId() == -1 && "Node already inserted!");
+      N->setNodeId(NodeSUnit->NodeNum);
     }
     
     // Scan down to find any flagged succs.