From 4667c4a309f7d49f858e14c4c2462fe595bcc536 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 1 Mar 2009 18:47:06 +0000 Subject: [PATCH] simplify some code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65782 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenModule.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 742923816b..b6b52cd8f7 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -793,8 +793,6 @@ llvm::Constant *CodeGenModule::GetAddrOfFunction(const FunctionDecl *D) { // Lookup the entry, lazily creating it if necessary. llvm::GlobalValue *&Entry = GlobalDeclMap[getMangledName(D)]; - if (!Entry) - Entry = getModule().getFunction(getMangledName(D)); if (!Entry) Entry = EmitForwardFunctionDefinition(D, 0); @@ -915,15 +913,13 @@ llvm::Value *CodeGenModule::getBuiltinLibFunction(unsigned BuiltinID) { assert(Existing == 0 && "FIXME: Name collision"); } - llvm::GlobalValue *&ExitingFn = GlobalDeclMap[getContext().Idents.get(Name).getName()]; - if (ExitingFn) { - llvm::Function *Fn = dyn_cast(ExitingFn); - assert(Fn && "builting mixing with non-function"); - return FunctionSlot = llvm::ConstantExpr::getBitCast(Fn, Ty); - } + llvm::GlobalValue *&ExistingFn = + GlobalDeclMap[getContext().Idents.get(Name).getName()]; + if (ExistingFn) + return FunctionSlot = llvm::ConstantExpr::getBitCast(ExistingFn, Ty); // FIXME: param attributes for sext/zext etc. - return FunctionSlot = ExitingFn = + return FunctionSlot = ExistingFn = llvm::Function::Create(Ty, llvm::Function::ExternalLinkage, Name, &getModule()); } -- 2.40.0