Apply Chris' suggestions.
authorEvan Cheng <evan.cheng@apple.com>
Wed, 17 Oct 2007 06:53:44 +0000 (06:53 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Wed, 17 Oct 2007 06:53:44 +0000 (06:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43069 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/LiveIntervalAnalysis.h
lib/CodeGen/LiveIntervalAnalysis.cpp
lib/CodeGen/RegAllocLinearScan.cpp

index c9f9d2dcc28ee81e76effc23c7f66dea343a4c25..6f41ab664c32372308a2e7e37b58835a3e94bb25 100644 (file)
@@ -167,7 +167,7 @@ namespace llvm {
     /// is live in any MBB returns true as well as the list of basic blocks
     /// where the value is live in.
     bool findLiveInMBBs(const LiveRange &LR,
-                        SmallVector<MachineBasicBlock*, 4> &MBBs) const;
+                        SmallVectorImpl<MachineBasicBlock*> &MBBs) const;
 
     // Interval creation
 
index 3aec772f1a9fabc141db9433881a36b467ece8f4..ca6c04d8f75712a3f274820991418d83cea94ed1 100644 (file)
@@ -817,7 +817,7 @@ void LiveIntervals::computeIntervals() {
 }
 
 bool LiveIntervals::findLiveInMBBs(const LiveRange &LR,
-                               SmallVector<MachineBasicBlock*, 4> &MBBs) const {
+                              SmallVectorImpl<MachineBasicBlock*> &MBBs) const {
   std::vector<IdxMBBPair>::const_iterator I =
     std::lower_bound(Idx2MBBMap.begin(), Idx2MBBMap.end(), LR.start);
 
index e74f3333d24531edb209b0dd40aaedf56a59ae7b..8a9eb3de0b505fc10e55bed142547b04977a7cc3 100644 (file)
@@ -290,6 +290,7 @@ void RALinScan::linearScan()
 
   // Add live-ins to every BB except for entry.
   MachineFunction::iterator EntryMBB = mf_->begin();
+  SmallVector<MachineBasicBlock*, 8> LiveInMBBs;
   for (LiveIntervals::iterator i = li_->begin(), e = li_->end(); i != e; ++i) {
     const LiveInterval &cur = i->second;
     unsigned Reg = 0;
@@ -302,11 +303,11 @@ void RALinScan::linearScan()
     for (LiveInterval::Ranges::const_iterator I = cur.begin(), E = cur.end();
          I != E; ++I) {
       const LiveRange &LR = *I;
-      SmallVector<MachineBasicBlock*, 4> LiveInMBBs;
       if (li_->findLiveInMBBs(LR, LiveInMBBs)) {
         for (unsigned i = 0, e = LiveInMBBs.size(); i != e; ++i)
           if (LiveInMBBs[i] != EntryMBB)
             LiveInMBBs[i]->addLiveIn(Reg);
+        LiveInMBBs.clear();
       }
     }
   }