@@ -316,6 +316,7 @@ FOR_KNOWN_FOUNDATION_TYPES(CACHE_FOUNDATION_DECL)
316
316
llvm::DenseMap<Type, ArraySliceType*> ArraySliceTypes;
317
317
llvm::DenseMap<std::pair<Type, Type>, DictionaryType *> DictionaryTypes;
318
318
llvm::DenseMap<Type, OptionalType*> OptionalTypes;
319
+ llvm::DenseMap<Type, ParenType*> SimpleParenTypes; // Most are simple
319
320
llvm::DenseMap<std::pair<Type, unsigned >, ParenType*> ParenTypes;
320
321
llvm::DenseMap<uintptr_t , ReferenceStorageType*> ReferenceStorageTypes;
321
322
llvm::DenseMap<Type, LValueType*> LValueTypes;
@@ -2094,6 +2095,7 @@ size_t ASTContext::Implementation::Arena::getTotalMemory() const {
2094
2095
llvm::capacity_in_bytes (ArraySliceTypes) +
2095
2096
llvm::capacity_in_bytes (DictionaryTypes) +
2096
2097
llvm::capacity_in_bytes (OptionalTypes) +
2098
+ llvm::capacity_in_bytes (SimpleParenTypes) +
2097
2099
llvm::capacity_in_bytes (ParenTypes) +
2098
2100
llvm::capacity_in_bytes (ReferenceStorageTypes) +
2099
2101
llvm::capacity_in_bytes (LValueTypes) +
@@ -3051,8 +3053,10 @@ ParenType *ParenType::get(const ASTContext &C, Type underlying,
3051
3053
3052
3054
auto properties = underlying->getRecursiveProperties ();
3053
3055
auto arena = getArena (properties);
3054
- ParenType *&Result =
3055
- C.getImpl ().getArena (arena).ParenTypes [{underlying, fl.toRaw ()}];
3056
+ auto flags = fl.toRaw ();
3057
+ ParenType *&Result = flags == 0
3058
+ ? C.getImpl ().getArena (arena).SimpleParenTypes [underlying]
3059
+ : C.getImpl ().getArena (arena).ParenTypes [{underlying, flags}];
3056
3060
if (Result == nullptr ) {
3057
3061
Result = new (C, arena) ParenType (underlying,
3058
3062
properties, fl);
0 commit comments