diff options
author | Chris Lattner <sabre@nondot.org> | 2007-08-31 04:44:06 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-08-31 04:44:06 +0000 |
commit | c5e940fa551840ecd71e8116c316c9131490f5fa (patch) | |
tree | 8f8c8e7fdfe403334889c0363525ff767e0abf09 /CodeGen/CodeGenModule.cpp | |
parent | bef20ac367a09555b30d6eb3847a81ec164caf88 (diff) |
Implement codegen support for lowering "library builtins" like __builtin_isinf
to their corresponding library routines (e.g. isinf). This allows us to handle
all the stuff in macos math.h, and other stuff as it's added to *Builtins.def.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41634 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CodeGen/CodeGenModule.cpp')
-rw-r--r-- | CodeGen/CodeGenModule.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/CodeGen/CodeGenModule.cpp b/CodeGen/CodeGenModule.cpp index a6a887f90f..ec3d0affae 100644 --- a/CodeGen/CodeGenModule.cpp +++ b/CodeGen/CodeGenModule.cpp @@ -127,7 +127,11 @@ llvm::Function *CodeGenModule::getBuiltinLibFunction(unsigned BuiltinID) { // and for the existing one to be turned into a constantexpr cast of the // builtin. In the case where the existing one is a static function, it // should just be renamed. - assert(getModule().getFunction(Name) == 0 && "FIXME: Name collision"); + if (llvm::Function *Existing = getModule().getFunction(Name)) { + if (Existing->getFunctionType() == Ty && Existing->hasExternalLinkage()) + return FunctionSlot = Existing; + assert(Existing == 0 && "FIXME: Name collision"); + } // FIXME: param attributes for sext/zext etc. return FunctionSlot = new llvm::Function(Ty, llvm::Function::ExternalLinkage, |