Turn some DenseMaps that are only used for set operations into DenseSets.

DenseSet has better memory efficiency now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223589 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer
2014-12-06 19:22:54 +00:00
parent 2cd5836249
commit 2991725fe2
4 changed files with 15 additions and 19 deletions

View File

@@ -1593,8 +1593,7 @@ bool Linker::StructTypeKeyInfo::isEqual(const StructType *LHS,
void Linker::IdentifiedStructTypeSet::addNonOpaque(StructType *Ty) {
assert(!Ty->isOpaque());
bool &Entry = NonOpaqueStructTypes[Ty];
Entry = true;
NonOpaqueStructTypes.insert(Ty);
}
void Linker::IdentifiedStructTypeSet::addOpaque(StructType *Ty) {
@@ -1609,7 +1608,7 @@ Linker::IdentifiedStructTypeSet::findNonOpaque(ArrayRef<Type *> ETypes,
auto I = NonOpaqueStructTypes.find_as(Key);
if (I == NonOpaqueStructTypes.end())
return nullptr;
return I->first;
return *I;
}
bool Linker::IdentifiedStructTypeSet::hasType(StructType *Ty) {
@@ -1618,7 +1617,7 @@ bool Linker::IdentifiedStructTypeSet::hasType(StructType *Ty) {
auto I = NonOpaqueStructTypes.find(Ty);
if (I == NonOpaqueStructTypes.end())
return false;
return I->first == Ty;
return *I == Ty;
}
void Linker::init(Module *M, DiagnosticHandlerFunction DiagnosticHandler) {