summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-09-14 04:33:21 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-09-14 04:33:21 +0000
commitff0553ec61c69fc1e117658ab591e259d40824d9 (patch)
treee6722eac29412f22da54b80b81674a60e75a8514 /clang/lib/CodeGen/CodeGenModule.cpp
parent4dc75de733da45b43667cecfc0b849eda453e5f5 (diff)
downloadbcm5719-llvm-ff0553ec61c69fc1e117658ab591e259d40824d9.tar.gz
bcm5719-llvm-ff0553ec61c69fc1e117658ab591e259d40824d9.zip
Fix subtle bug in generating LLVM function declarations for builtin functions.
The decl wasn't being passed down, which meant that function attributes were not being set correctly. This is particularly important for ARM, since it wants to override the calling convention. Instead we would emit the builtin with the wrong calling convention, and instcombine would come along and merrily shred all the calls to it. :) llvm-svn: 81756
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 05f14682d78..fca6ebefda4 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -1256,7 +1256,8 @@ void CodeGenModule::EmitAliasDefinition(const ValueDecl *D) {
/// getBuiltinLibFunction - Given a builtin id for a function like
/// "__builtin_fabsf", return a Function* for "fabsf".
-llvm::Value *CodeGenModule::getBuiltinLibFunction(unsigned BuiltinID) {
+llvm::Value *CodeGenModule::getBuiltinLibFunction(const FunctionDecl *FD,
+ unsigned BuiltinID) {
assert((Context.BuiltinInfo.isLibFunction(BuiltinID) ||
Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID)) &&
"isn't a lib fn");
@@ -1276,8 +1277,7 @@ llvm::Value *CodeGenModule::getBuiltinLibFunction(unsigned BuiltinID) {
// Unique the name through the identifier table.
Name = getContext().Idents.get(Name).getName();
- // FIXME: param attributes for sext/zext etc.
- return GetOrCreateLLVMFunction(Name, Ty, GlobalDecl());
+ return GetOrCreateLLVMFunction(Name, Ty, GlobalDecl(FD));
}
llvm::Function *CodeGenModule::getIntrinsic(unsigned IID,const llvm::Type **Tys,
OpenPOWER on IntegriCloud