[llvm-commits] CVS: llvm/lib/CodeGen/DwarfWriter.cpp
    Duncan Sands 
    baldrick at free.fr
       
    Fri Jun  8 01:59:33 PDT 2007
    
    
  
Changes in directory llvm/lib/CodeGen:
DwarfWriter.cpp updated: 1.151 -> 1.152
---
Log message:
Use more realistically sized vectors.  Reserve capacity if we know in advance
how much will be used.
---
Diffs of the changes:  (+7 -4)
 DwarfWriter.cpp |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
Index: llvm/lib/CodeGen/DwarfWriter.cpp
diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.151 llvm/lib/CodeGen/DwarfWriter.cpp:1.152
--- llvm/lib/CodeGen/DwarfWriter.cpp:1.151	Wed Jun  6 10:37:31 2007
+++ llvm/lib/CodeGen/DwarfWriter.cpp	Fri Jun  8 03:59:11 2007
@@ -2973,16 +2973,19 @@
 
     // Sort the landing pads in order of their type ids.  This is used to fold
     // duplicate actions.
-    SmallVector<const LandingPadInfo *, 32> LandingPads(PadInfos.size(), NULL);
+    SmallVector<const LandingPadInfo *, 64> LandingPads;
+
+    LandingPads.reserve(PadInfos.size());
     for (unsigned i = 0, N = PadInfos.size(); i != N; ++i)
-      LandingPads[i] = &PadInfos[i];
+      LandingPads.push_back(&PadInfos[i]);
     std::sort(LandingPads.begin(), LandingPads.end(), PadLT);
 
     // Gather first action index for each landing pad site.
-    SmallVector<unsigned, 32> FirstActions;
+    SmallVector<unsigned, 64> FirstActions;
+    FirstActions.reserve(PadInfos.size());
 
     // The actions table.
-    SmallVector<ActionEntry, 64> Actions;
+    SmallVector<ActionEntry, 32> Actions;
 
     // Compute sizes for exception table.
     unsigned SizeSites = 0;
    
    
More information about the llvm-commits
mailing list