]> granicus.if.org Git - clang/commitdiff
If this is an intrinsic function, set the function's attributes to the intrinsic...
authorPeter Collingbourne <peter@pcc.me.uk>
Wed, 6 Apr 2011 12:29:04 +0000 (12:29 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Wed, 6 Apr 2011 12:29:04 +0000 (12:29 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129000 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CodeGenModule.cpp

index d180a2253ef99a49dcc567919f6ffb931cfcda4f..34f594ecaa9c186b4038b6b59866ff0233be45dc 100644 (file)
@@ -505,6 +505,13 @@ void CodeGenModule::SetInternalFunctionAttributes(const Decl *D,
 void CodeGenModule::SetFunctionAttributes(GlobalDecl GD,
                                           llvm::Function *F,
                                           bool IsIncompleteFunction) {
+  if (unsigned IID = F->getIntrinsicID()) {
+    // If this is an intrinsic function, set the function's attributes
+    // to the intrinsic's attributes.
+    F->setAttributes(llvm::Intrinsic::getAttributes((llvm::Intrinsic::ID)IID));
+    return;
+  }
+
   const FunctionDecl *FD = cast<FunctionDecl>(GD.getDecl());
 
   if (!IsIncompleteFunction)