aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-08-17 17:25:25 +0000
committerChris Lattner <sabre@nondot.org>2008-08-17 17:25:25 +0000
commit3432f49dfa93373f34f7b4f1d83d0bf116c0af95 (patch)
tree9a329798d940dba5b1381c7a58494cfc92be3ffa
parent46c16c5696d6c94551ffc77e88ed1ae857884b55 (diff)
downloadexternal_llvm-3432f49dfa93373f34f7b4f1d83d0bf116c0af95.tar.gz
external_llvm-3432f49dfa93373f34f7b4f1d83d0bf116c0af95.tar.bz2
external_llvm-3432f49dfa93373f34f7b4f1d83d0bf116c0af95.zip
switch valuemap's from std::map to densemap. This speeds up llvm-dis
on a stripped kc++ .bc file from 0.83 to 0.77s (8%) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54896 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/VMCore/AsmWriter.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index cf29b5a104..87d0da5b8f 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/lib/VMCore/AsmWriter.cpp
@@ -26,6 +26,7 @@
#include "llvm/Module.h"
#include "llvm/ValueSymbolTable.h"
#include "llvm/TypeSymbolTable.h"
+#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/CFG.h"
@@ -46,7 +47,7 @@ AssemblyAnnotationWriter::~AssemblyAnnotationWriter() {}
class SlotMachine {
public:
/// ValueMap - A mapping of Values to slot numbers
- typedef std::map<const Value*, unsigned> ValueMap;
+ typedef DenseMap<const Value*, unsigned> ValueMap;
private:
/// TheModule - The module for which we are holding slot numbers
@@ -1605,7 +1606,7 @@ SlotMachine::SlotMachine(const Module *M)
: TheModule(M) ///< Saved for lazy initialization.
, TheFunction(0)
, FunctionProcessed(false)
- , mNext(0), fMap(), fNext(0)
+ , mNext(0), fNext(0)
{
}
@@ -1615,7 +1616,7 @@ SlotMachine::SlotMachine(const Function *F)
: TheModule(F ? F->getParent() : 0) ///< Saved for lazy initialization
, TheFunction(F) ///< Saved for lazy initialization
, FunctionProcessed(false)
- , mNext(0), fMap(), fNext(0)
+ , mNext(0), fNext(0)
{
}
@@ -1694,10 +1695,8 @@ int SlotMachine::getGlobalSlot(const GlobalValue *V) {
initialize();
// Find the type plane in the module map
- ValueMap::const_iterator MI = mMap.find(V);
- if (MI == mMap.end()) return -1;
-
- return MI->second;
+ ValueMap::iterator MI = mMap.find(V);
+ return MI == mMap.end() ? -1 : MI->second;
}
@@ -1708,10 +1707,8 @@ int SlotMachine::getLocalSlot(const Value *V) {
// Check for uninitialized state and do lazy initialization.
initialize();
- ValueMap::const_iterator FI = fMap.find(V);
- if (FI == fMap.end()) return -1;
-
- return FI->second;
+ ValueMap::iterator FI = fMap.find(V);
+ return FI == fMap.end() ? -1 : FI->second;
}