[PATCH] D62535: [ThinLTO] Use original alias visibility when importing

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 29 09:50:11 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL361989: [ThinLTO] Use original alias visibility when importing (authored by tejohnson, committed by ).

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62535/new/

https://reviews.llvm.org/D62535

Files:
  llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp
  llvm/trunk/test/ThinLTO/X86/Inputs/alias_import.ll
  llvm/trunk/test/ThinLTO/X86/alias_import.ll


Index: llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp
===================================================================
--- llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp
+++ llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp
@@ -1053,9 +1053,10 @@
 
   ValueToValueMapTy VMap;
   Function *NewFn = CloneFunction(Fn, VMap);
-  // Clone should use the original alias's linkage and name, and we ensure
-  // all uses of alias instead use the new clone (casted if necessary).
+  // Clone should use the original alias's linkage, visibility and name, and we
+  // ensure all uses of alias instead use the new clone (casted if necessary).
   NewFn->setLinkage(GA->getLinkage());
+  NewFn->setVisibility(GA->getVisibility());
   GA->replaceAllUsesWith(ConstantExpr::getBitCast(NewFn, GA->getType()));
   NewFn->takeName(GA);
   return NewFn;
Index: llvm/trunk/test/ThinLTO/X86/alias_import.ll
===================================================================
--- llvm/trunk/test/ThinLTO/X86/alias_import.ll
+++ llvm/trunk/test/ThinLTO/X86/alias_import.ll
@@ -38,7 +38,7 @@
 ; PROMOTE-DAG: @linkonceODRfuncLinkonceAlias = weak alias void (...), bitcast (void ()* @linkonceODRfunc to void (...)*)
 ; PROMOTE-DAG: @linkonceODRfuncLinkonceODRAlias = weak_odr alias void (...), bitcast (void ()* @linkonceODRfunc to void (...)*)
 
-; PROMOTE-DAG: define void @globalfunc()
+; PROMOTE-DAG: define hidden void @globalfunc()
 ; PROMOTE-DAG: define internal void @internalfunc()
 ; PROMOTE-DAG: define weak_odr void @linkonceODRfunc()
 ; PROMOTE-DAG: define weak_odr void @weakODRfunc()
@@ -52,11 +52,11 @@
 ; IMPORT-DAG: define available_externally void @linkonceODRfuncAlias
 ; IMPORT-DAG: define available_externally void @linkonceODRfuncWeakODRAlias
 ; IMPORT-DAG: define available_externally void @linkonceODRfuncLinkonceODRAlias
-; IMPORT-DAG: define available_externally void @globalfuncAlias()
+; IMPORT-DAG: define available_externally dso_local void @globalfuncAlias()
 ; IMPORT-DAG: declare void @globalfuncWeakAlias()
 ; IMPORT-DAG: declare void @globalfuncLinkonceAlias()
-; IMPORT-DAG: define available_externally void @globalfuncWeakODRAlias()
-; IMPORT-DAG: define available_externally void @globalfuncLinkonceODRAlias()
+; IMPORT-DAG: define available_externally dso_local void @globalfuncWeakODRAlias()
+; IMPORT-DAG: define available_externally dso_local void @globalfuncLinkonceODRAlias()
 ; IMPORT-DAG: define available_externally dso_local void @internalfuncAlias()
 ; IMPORT-DAG: declare void @internalfuncWeakAlias()
 ; IMPORT-DAG: declare void @internalfuncLinkonceAlias()
Index: llvm/trunk/test/ThinLTO/X86/Inputs/alias_import.ll
===================================================================
--- llvm/trunk/test/ThinLTO/X86/Inputs/alias_import.ll
+++ llvm/trunk/test/ThinLTO/X86/Inputs/alias_import.ll
@@ -5,7 +5,7 @@
 @globalfuncLinkonceAlias = linkonce alias void (...), bitcast (void ()* @globalfunc to void (...)*)
 @globalfuncWeakODRAlias = weak_odr alias void (...), bitcast (void ()* @globalfunc to void (...)*)
 @globalfuncLinkonceODRAlias = linkonce_odr alias void (...), bitcast (void ()* @globalfunc to void (...)*)
-define void @globalfunc() {
+define hidden void @globalfunc() {
 entry:
   ret void
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62535.201967.patch
Type: text/x-patch
Size: 3238 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190529/f78d8d1e/attachment.bin>


More information about the llvm-commits mailing list