diff options
author | Chris Lattner <sabre@nondot.org> | 2007-01-12 23:23:08 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-01-12 23:23:08 +0000 |
commit | a55866f2ccf3fec442b08a59ad46c82b4a70cd9a (patch) | |
tree | 32ea17d33913f9e1bcf47f143cdcf9c0898dc3fa /lib/Bytecode/Writer/SlotCalculator.cpp | |
parent | 7aa8a459227ea02263d92e48ef109da3c0e0a5fb (diff) |
Eliminate a log(n) lookup
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33155 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode/Writer/SlotCalculator.cpp')
-rw-r--r-- | lib/Bytecode/Writer/SlotCalculator.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Bytecode/Writer/SlotCalculator.cpp b/lib/Bytecode/Writer/SlotCalculator.cpp index 2d4cd0c4cb..65215fecb1 100644 --- a/lib/Bytecode/Writer/SlotCalculator.cpp +++ b/lib/Bytecode/Writer/SlotCalculator.cpp @@ -279,7 +279,7 @@ void SlotCalculator::processSymbolTableConstants(const SymbolTable *ST) { void SlotCalculator::incorporateFunction(const Function *F) { - assert((ModuleLevel.size() == 0 || + assert((ModuleLevel.empty() || ModuleTypeLevel == 0) && "Module already incorporated!"); SC_DEBUG("begin processFunction!\n"); @@ -442,7 +442,7 @@ unsigned SlotCalculator::getOrCreateCompactionTableSlot(const Type *T) { unsigned SlotNo = CompactionTypes.size(); SC_DEBUG("Inserting Compaction Type #" << SlotNo << ": " << *T << "\n"); CompactionTypes.push_back(T); - CompactionTypeMap[T] = SlotNo; + CompactionTypeMap.insert(I, std::make_pair(T, SlotNo)); return SlotNo; } @@ -639,7 +639,7 @@ void SlotCalculator::pruneCompactionTable() { /// to determine if its actually empty. bool SlotCalculator::CompactionTableIsEmpty() const { // Check a degenerate case, just in case. - if (CompactionTable.size() == 0) + if (CompactionTable.empty()) return true; // Check each plane |