From 1f6f961293da9c2b1c23da2411c1b439a9502ed0 Mon Sep 17 00:00:00 2001 From: John McCall Date: Wed, 9 Mar 2011 08:12:35 +0000 Subject: Fix three of the four places where I left breadcrumbs to avoid unnecessary recomputation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127322 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenModule.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/CodeGen/CodeGenModule.cpp') diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 5aeaf03553..a758d610f8 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -1392,10 +1392,12 @@ static void ReplaceUsesOfNonProtoTypeWithRealFunction(llvm::GlobalValue *Old, void CodeGenModule::EmitGlobalFunctionDefinition(GlobalDecl GD) { const FunctionDecl *D = cast(GD.getDecl()); + // Compute the function info and LLVM type. const CGFunctionInfo &FI = getTypes().getFunctionInfo(GD); - - // FIXME: re-use FI in this computation! - const llvm::FunctionType *Ty = getTypes().GetFunctionType(GD); + bool variadic = false; + if (const FunctionProtoType *fpt = D->getType()->getAs()) + variadic = fpt->isVariadic(); + const llvm::FunctionType *Ty = getTypes().GetFunctionType(FI, variadic, false); // Get or create the prototype for the function. llvm::Constant *Entry = GetAddrOfFunction(GD, Ty); -- cgit v1.2.3-18-g5258