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

@@ -360,8 +360,7 @@ FunctionType *FunctionType::get(Type *ReturnType,
ArrayRef<Type*> Params, bool isVarArg) {
LLVMContextImpl *pImpl = ReturnType->getContext().pImpl;
FunctionTypeKeyInfo::KeyTy Key(ReturnType, Params, isVarArg);
LLVMContextImpl::FunctionTypeMap::iterator I =
pImpl->FunctionTypes.find_as(Key);
auto I = pImpl->FunctionTypes.find_as(Key);
FunctionType *FT;
if (I == pImpl->FunctionTypes.end()) {
@@ -369,9 +368,9 @@ FunctionType *FunctionType::get(Type *ReturnType,
Allocate(sizeof(FunctionType) + sizeof(Type*) * (Params.size() + 1),
AlignOf<FunctionType>::Alignment);
new (FT) FunctionType(ReturnType, Params, isVarArg);
pImpl->FunctionTypes[FT] = true;
pImpl->FunctionTypes.insert(FT);
} else {
FT = I->first;
FT = *I;
}
return FT;
@@ -404,8 +403,7 @@ StructType *StructType::get(LLVMContext &Context, ArrayRef<Type*> ETypes,
bool isPacked) {
LLVMContextImpl *pImpl = Context.pImpl;
AnonStructTypeKeyInfo::KeyTy Key(ETypes, isPacked);
LLVMContextImpl::StructTypeMap::iterator I =
pImpl->AnonStructTypes.find_as(Key);
auto I = pImpl->AnonStructTypes.find_as(Key);
StructType *ST;
if (I == pImpl->AnonStructTypes.end()) {
@@ -413,9 +411,9 @@ StructType *StructType::get(LLVMContext &Context, ArrayRef<Type*> ETypes,
ST = new (Context.pImpl->TypeAllocator) StructType(Context);
ST->setSubclassData(SCDB_IsLiteral); // Literal struct.
ST->setBody(ETypes, isPacked);
Context.pImpl->AnonStructTypes[ST] = true;
Context.pImpl->AnonStructTypes.insert(ST);
} else {
ST = I->first;
ST = *I;
}
return ST;