[cfe-commits] r65782 - /cfe/trunk/lib/CodeGen/CodeGenModule.cpp
Chris Lattner
sabre at nondot.org
Sun Mar 1 10:47:07 PST 2009
Author: lattner
Date: Sun Mar 1 12:47:06 2009
New Revision: 65782
URL: http://llvm.org/viewvc/llvm-project?rev=65782&view=rev
Log:
simplify some code.
Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=65782&r1=65781&r2=65782&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Sun Mar 1 12:47:06 2009
@@ -794,8 +794,6 @@
// 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 @@
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());
}
More information about the cfe-commits
mailing list