Really cache function types and anonymous struct types.
authorJay Foad <jay.foad@gmail.com>
Wed, 13 Jul 2011 10:39:49 +0000 (10:39 +0000)
committerJay Foad <jay.foad@gmail.com>
Wed, 13 Jul 2011 10:39:49 +0000 (10:39 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135042 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Type.cpp

index dc5053acc24ca85480eed4478f958c8b4b8ce872..67fad98324896f47e321b7645d7c59e53a216d45 100644 (file)
@@ -343,6 +343,8 @@ FunctionType *FunctionType::get(const Type *ReturnType,
     FT = (FunctionType*) operator new(sizeof(FunctionType) +
                                     sizeof(Type*)*(Params.size()+1));
     new (FT) FunctionType(ReturnType, Params, isVarArg);
+
+    ReturnType->getContext().pImpl->FunctionTypes[Key] = FT;
   }
 
   return FT;
@@ -393,6 +395,9 @@ StructType *StructType::get(LLVMContext &Context, ArrayRef<Type*> ETypes,
   ST = new StructType(Context);
   ST->setSubclassData(SCDB_IsAnonymous);  // Anonymous struct.
   ST->setBody(ETypes, isPacked);
+
+  Context.pImpl->AnonStructTypes[Key] = ST;
+
   return ST;
 }