Eliminate a log(n) lookup

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33155 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2007-01-12 23:23:08 +00:00
parent 7aa8a45922
commit a55866f2cc

View File

@ -279,7 +279,7 @@ void SlotCalculator::processSymbolTableConstants(const SymbolTable *ST) {
void SlotCalculator::incorporateFunction(const Function *F) { void SlotCalculator::incorporateFunction(const Function *F) {
assert((ModuleLevel.size() == 0 || assert((ModuleLevel.empty() ||
ModuleTypeLevel == 0) && "Module already incorporated!"); ModuleTypeLevel == 0) && "Module already incorporated!");
SC_DEBUG("begin processFunction!\n"); SC_DEBUG("begin processFunction!\n");
@ -442,7 +442,7 @@ unsigned SlotCalculator::getOrCreateCompactionTableSlot(const Type *T) {
unsigned SlotNo = CompactionTypes.size(); unsigned SlotNo = CompactionTypes.size();
SC_DEBUG("Inserting Compaction Type #" << SlotNo << ": " << *T << "\n"); SC_DEBUG("Inserting Compaction Type #" << SlotNo << ": " << *T << "\n");
CompactionTypes.push_back(T); CompactionTypes.push_back(T);
CompactionTypeMap[T] = SlotNo; CompactionTypeMap.insert(I, std::make_pair(T, SlotNo));
return SlotNo; return SlotNo;
} }
@ -639,7 +639,7 @@ void SlotCalculator::pruneCompactionTable() {
/// to determine if its actually empty. /// to determine if its actually empty.
bool SlotCalculator::CompactionTableIsEmpty() const { bool SlotCalculator::CompactionTableIsEmpty() const {
// Check a degenerate case, just in case. // Check a degenerate case, just in case.
if (CompactionTable.size() == 0) if (CompactionTable.empty())
return true; return true;
// Check each plane // Check each plane