[PATCH] D44710: Set dso_local on builtin functions

Rafael Avila de Espindola via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 20 15:03:01 PDT 2018


espindola created this revision.
espindola added reviewers: rnk, echristo.

With https://reviews.llvm.org/D44706 we can just forward to CreateRuntimeFunction.


https://reviews.llvm.org/D44710

Files:
  lib/CodeGen/CodeGenModule.cpp
  test/CodeGen/mingw-long-double.c


Index: test/CodeGen/mingw-long-double.c
===================================================================
--- test/CodeGen/mingw-long-double.c
+++ test/CodeGen/mingw-long-double.c
@@ -42,6 +42,6 @@
 // GNU64: define dso_local void @TestLDC({ x86_fp80, x86_fp80 }* noalias sret %agg.result, { x86_fp80, x86_fp80 }* %x)
 // MSC64: define dso_local void @TestLDC({ double, double }* noalias sret %agg.result, { double, double }* %x)
 
-// GNU32: declare void @__mulxc3
-// GNU64: declare void @__mulxc3
-// MSC64: declare void @__muldc3
+// GNU32: declare dso_local void @__mulxc3
+// GNU64: declare dso_local void @__mulxc3
+// MSC64: declare dso_local void @__muldc3
Index: lib/CodeGen/CodeGenModule.cpp
===================================================================
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -2640,13 +2640,7 @@
 llvm::Constant *
 CodeGenModule::CreateBuiltinFunction(llvm::FunctionType *FTy, StringRef Name,
                                      llvm::AttributeList ExtraAttrs) {
-  llvm::Constant *C =
-      GetOrCreateLLVMFunction(Name, FTy, GlobalDecl(), /*ForVTable=*/false,
-                              /*DontDefer=*/false, /*IsThunk=*/false, ExtraAttrs);
-  if (auto *F = dyn_cast<llvm::Function>(C))
-    if (F->empty())
-      F->setCallingConv(getRuntimeCC());
-  return C;
+  return CreateRuntimeFunction(FTy, Name, ExtraAttrs, true);
 }
 
 /// isTypeConstant - Determine whether an object of this type can be emitted


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44710.139208.patch
Type: text/x-patch
Size: 1484 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180320/e1798587/attachment.bin>


More information about the cfe-commits mailing list