Fix three of the four places where I left breadcrumbs to avoid unnecessary

recomputation.

llvm-svn: 127322
This commit is contained in:
John McCall
2011-03-09 08:12:35 +00:00
parent 718918b07a
commit 46288eff24
3 changed files with 63 additions and 54 deletions

View File

@@ -1392,10 +1392,12 @@ static void ReplaceUsesOfNonProtoTypeWithRealFunction(llvm::GlobalValue *Old,
void CodeGenModule::EmitGlobalFunctionDefinition(GlobalDecl GD) {
const FunctionDecl *D = cast<FunctionDecl>(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<FunctionProtoType>())
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);