From 2d54705c4b8c83b47cb7d03d488b3eda34158ada Mon Sep 17 00:00:00 2001 From: Alkis Evlogimenos Date: Wed, 21 Jul 2004 09:46:55 +0000 Subject: [PATCH] Change std::list into a std::vector for IntervalSets. This reduces compile time for 176.gcc from 5.6 secs to 4.7 secs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15072 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/RegAllocIterativeScan.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/CodeGen/RegAllocIterativeScan.cpp b/lib/CodeGen/RegAllocIterativeScan.cpp index b92fc747457..63fd358451f 100644 --- a/lib/CodeGen/RegAllocIterativeScan.cpp +++ b/lib/CodeGen/RegAllocIterativeScan.cpp @@ -53,7 +53,7 @@ namespace { const TargetMachine* tm_; const MRegisterInfo* mri_; LiveIntervals* li_; - typedef std::list IntervalPtrs; + typedef std::vector IntervalPtrs; IntervalPtrs unhandled_, fixed_, active_, inactive_, handled_, spilled_; std::auto_ptr prt_; @@ -196,7 +196,8 @@ bool RA::linearScan() << mf_->getFunction()->getName() << '\n'); - unhandled_.sort(less_ptr()); + std::sort(unhandled_.begin(), unhandled_.end(), + greater_ptr()); DEBUG(printIntervals("unhandled", unhandled_.begin(), unhandled_.end())); DEBUG(printIntervals("fixed", fixed_.begin(), fixed_.end())); DEBUG(printIntervals("active", active_.begin(), active_.end())); @@ -204,8 +205,8 @@ bool RA::linearScan() while (!unhandled_.empty()) { // pick the interval with the earliest start point - IntervalPtrs::value_type cur = unhandled_.front(); - unhandled_.pop_front(); + IntervalPtrs::value_type cur = unhandled_.back(); + unhandled_.pop_back(); ++numIterations; DEBUG(std::cerr << "\n*** CURRENT ***: " << *cur << '\n');