Move a DenseMap's declaration outside of a loop, and just call
authorDan Gohman <gohman@apple.com>
Mon, 23 Jun 2008 21:15:00 +0000 (21:15 +0000)
committerDan Gohman <gohman@apple.com>
Mon, 23 Jun 2008 21:15:00 +0000 (21:15 +0000)
clear() on each iteration. This avoids allocating and deallocating
all of DenseMap's memory on each iteration.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52642 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp

index a50dd7b7c5d37c33476b292f4d95dfcdd71d2f3b..f6d68f1ebd8672b0993d5562ae7fc2efa4621e91 100644 (file)
@@ -953,10 +953,11 @@ void ScheduleDAGRRList::ListScheduleBottomUp() {
   // While Available queue is not empty, grab the node with the highest
   // priority. If it is not ready put it back.  Schedule the node.
   SmallVector<SUnit*, 4> NotReady;
+  DenseMap<SUnit*, SmallVector<unsigned, 4> > LRegsMap;
   Sequence.reserve(SUnits.size());
   while (!AvailableQueue->empty()) {
     bool Delayed = false;
-    DenseMap<SUnit*, SmallVector<unsigned, 4> > LRegsMap;
+    LRegsMap.clear();
     SUnit *CurSU = AvailableQueue->pop();
     while (CurSU) {
       if (CurSU->CycleBound <= CurCycle) {