summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-03-01 18:47:06 +0000
committerChris Lattner <sabre@nondot.org>2009-03-01 18:47:06 +0000
commita01c21f61667d231b5815e8b0b6e51abeace5d10 (patch)
tree8f9deee205e83f9476900691e8b2bec8f2a4681d /clang/lib/CodeGen/CodeGenModule.cpp
parent254225489a4a3911481d5a667adcae6592f61fa9 (diff)
downloadbcm5719-llvm-a01c21f61667d231b5815e8b0b6e51abeace5d10.tar.gz
bcm5719-llvm-a01c21f61667d231b5815e8b0b6e51abeace5d10.zip
simplify some code.
llvm-svn: 65782
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 742923816b5..b6b52cd8f79 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -794,8 +794,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);
return llvm::ConstantExpr::getBitCast(Entry, PTy);
@@ -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<llvm::Function>(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());
}
OpenPOWER on IntegriCloud