@@ -316,6 +316,7 @@ FOR_KNOWN_FOUNDATION_TYPES(CACHE_FOUNDATION_DECL)
316316 llvm::DenseMap<Type, ArraySliceType*> ArraySliceTypes;
317317 llvm::DenseMap<std::pair<Type, Type>, DictionaryType *> DictionaryTypes;
318318 llvm::DenseMap<Type, OptionalType*> OptionalTypes;
319+ llvm::DenseMap<Type, ParenType*> SimpleParenTypes; // Most are simple
319320 llvm::DenseMap<std::pair<Type, unsigned >, ParenType*> ParenTypes;
320321 llvm::DenseMap<uintptr_t , ReferenceStorageType*> ReferenceStorageTypes;
321322 llvm::DenseMap<Type, LValueType*> LValueTypes;
@@ -2094,6 +2095,7 @@ size_t ASTContext::Implementation::Arena::getTotalMemory() const {
20942095 llvm::capacity_in_bytes (ArraySliceTypes) +
20952096 llvm::capacity_in_bytes (DictionaryTypes) +
20962097 llvm::capacity_in_bytes (OptionalTypes) +
2098+ llvm::capacity_in_bytes (SimpleParenTypes) +
20972099 llvm::capacity_in_bytes (ParenTypes) +
20982100 llvm::capacity_in_bytes (ReferenceStorageTypes) +
20992101 llvm::capacity_in_bytes (LValueTypes) +
@@ -3051,8 +3053,10 @@ ParenType *ParenType::get(const ASTContext &C, Type underlying,
30513053
30523054 auto properties = underlying->getRecursiveProperties ();
30533055 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}];
30563060 if (Result == nullptr ) {
30573061 Result = new (C, arena) ParenType (underlying,
30583062 properties, fl);
0 commit comments