[llvm-commits] [llvm] r127254 - /llvm/trunk/lib/CodeGen/LiveVariables.cpp

Benjamin Kramer benny.kra at googlemail.com
Tue Mar 8 09:28:36 PST 2011


Author: d0k
Date: Tue Mar  8 11:28:36 2011
New Revision: 127254

URL: http://llvm.org/viewvc/llvm-project?rev=127254&view=rev
Log:
Reduce vector reallocations.

Modified:
    llvm/trunk/lib/CodeGen/LiveVariables.cpp

Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveVariables.cpp?rev=127254&r1=127253&r2=127254&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveVariables.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveVariables.cpp Tue Mar  8 11:28:36 2011
@@ -107,9 +107,7 @@
   // Mark the variable known alive in this bb
   VRInfo.AliveBlocks.set(BBNum);
 
-  for (MachineBasicBlock::const_pred_reverse_iterator PI = MBB->pred_rbegin(),
-         E = MBB->pred_rend(); PI != E; ++PI)
-    WorkList.push_back(*PI);
+  WorkList.insert(WorkList.end(), MBB->pred_rbegin(), MBB->pred_rend());
 }
 
 void LiveVariables::MarkVirtRegAliveInBlock(VarInfo &VRInfo,
@@ -707,7 +705,7 @@
 
   // Loop over all of the successors of the basic block, checking to see if
   // the value is either live in the block, or if it is killed in the block.
-  std::vector<MachineBasicBlock*> OpSuccBlocks;
+  SmallVector<MachineBasicBlock*, 8> OpSuccBlocks;
   for (MachineBasicBlock::const_succ_iterator SI = MBB.succ_begin(),
          E = MBB.succ_end(); SI != E; ++SI) {
     MachineBasicBlock *SuccMBB = *SI;





More information about the llvm-commits mailing list