[llvm-commits] CVS: llvm/lib/Bytecode/Writer/Writer.cpp

Chris Lattner sabre at nondot.org
Fri Feb 9 23:32:00 PST 2007



Changes in directory llvm/lib/Bytecode/Writer:

Writer.cpp updated: 1.163 -> 1.164
---
Log message:

Make BytecodeWriter::outputValueSymbolTable *significantly* less abusive
of memory, through a combination of DenseMap and SmallVector.  This speeds
up bcwriter on 447.dealII from 1.31s to 0.82s (60% faster).


---
Diffs of the changes:  (+4 -3)

 Writer.cpp |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)


Index: llvm/lib/Bytecode/Writer/Writer.cpp
diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.163 llvm/lib/Bytecode/Writer/Writer.cpp:1.164
--- llvm/lib/Bytecode/Writer/Writer.cpp:1.163	Sat Feb 10 01:11:51 2007
+++ llvm/lib/Bytecode/Writer/Writer.cpp	Sat Feb 10 01:31:44 2007
@@ -33,6 +33,7 @@
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/Streams.h"
 #include "llvm/System/Program.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/Statistic.h"
 #include <cstring>
@@ -1087,15 +1088,15 @@
 
   // Organize the symbol table by type
   typedef std::pair<const std::string*, const Value*> PlaneMapEntry;
-  typedef std::vector<PlaneMapEntry> PlaneMapVector;
-  typedef std::map<const Type*, PlaneMapVector > PlaneMap;
+  typedef SmallVector<PlaneMapEntry, 8> PlaneMapVector;
+  typedef DenseMap<const Type*, PlaneMapVector > PlaneMap;
   PlaneMap Planes;
   for (ValueSymbolTable::const_iterator SI = VST.begin(), SE = VST.end();
        SI != SE; ++SI) 
     Planes[SI->second->getType()]
       .push_back(std::make_pair(&SI->first, SI->second));
 
-  for (PlaneMap::const_iterator PI = Planes.begin(), PE = Planes.end();
+  for (PlaneMap::iterator PI = Planes.begin(), PE = Planes.end();
        PI != PE; ++PI) {
     PlaneMapVector::const_iterator I = PI->second.begin(); 
     PlaneMapVector::const_iterator End = PI->second.end(); 






More information about the llvm-commits mailing list