From 75f67e0d8daa6201675d7bdec86e7e4f995f969f Mon Sep 17 00:00:00 2001 From: Jay Foad Date: Wed, 13 Jul 2011 10:39:49 +0000 Subject: [PATCH] Really cache function types and anonymous struct types. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135042 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/VMCore/Type.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp index dc5053acc24..67fad983248 100644 --- a/lib/VMCore/Type.cpp +++ b/lib/VMCore/Type.cpp @@ -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 ETypes, ST = new StructType(Context); ST->setSubclassData(SCDB_IsAnonymous); // Anonymous struct. ST->setBody(ETypes, isPacked); + + Context.pImpl->AnonStructTypes[Key] = ST; + return ST; }