Clean up some uses of std::distance, now that we have allnodes_size.
authorDan Gohman <gohman@apple.com>
Fri, 20 Jun 2008 17:15:19 +0000 (17:15 +0000)
committerDan Gohman <gohman@apple.com>
Fri, 20 Jun 2008 17:15:19 +0000 (17:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52545 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
lib/CodeGen/SelectionDAG/ScheduleDAG.cpp

index 883ba38ca3409ad6ea7170e5fbc0b51a6689416a..3be33770bc88fee9615dbd13a68c3a8635c9fd63 100644 (file)
@@ -313,8 +313,7 @@ static void ComputeTopDownOrdering(SelectionDAG &DAG,
   }
 
   assert(Order.size() == Visited.size() &&
-         Order.size() == 
-         (unsigned)std::distance(DAG.allnodes_begin(), DAG.allnodes_end()) &&
+         Order.size() == DAG.allnodes_size() &&
          "Error: DAG is cyclic!");
 }
 
index d60d2b02ef0f2c31a5c3a184629185ee2673026a..d3cc11693e4a026567948c710d493c93ca523c26 100644 (file)
@@ -97,7 +97,7 @@ void ScheduleDAG::BuildSchedUnits() {
   // Reserve entries in the vector for each of the SUnits we are creating.  This
   // ensure that reallocation of the vector won't happen, so SUnit*'s won't get
   // invalidated.
-  SUnits.reserve(std::distance(DAG.allnodes_begin(), DAG.allnodes_end()));
+  SUnits.reserve(DAG.allnodes_size());
   
   for (SelectionDAG::allnodes_iterator NI = DAG.allnodes_begin(),
        E = DAG.allnodes_end(); NI != E; ++NI) {
@@ -105,7 +105,7 @@ void ScheduleDAG::BuildSchedUnits() {
       continue;
     
     // If this node has already been processed, stop now.
-    if (SUnitMap[NI].size()) continue;
+    if (!SUnitMap[NI].empty()) continue;
     
     SUnit *NodeSUnit = NewSUnit(NI);