浏览代码

If this is an intrinsic function, set the function's attributes to the intrinsic's attributes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129000 91177308-0d34-0410-b5e6-96231b3b80d8
Peter Collingbourne 14 年之前
父节点
当前提交
0ac2cf4d28
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      lib/CodeGen/CodeGenModule.cpp

+ 7 - 0
lib/CodeGen/CodeGenModule.cpp

@@ -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)