summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/FunctionImport.cpp
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2019-05-29 16:50:46 +0000
committerTeresa Johnson <tejohnson@google.com>2019-05-29 16:50:46 +0000
commit5b2088d1fac1f464cd51d4b660b29c5db47a54c4 (patch)
tree4fd2625a02848301f0389ed2c15cf0746c673053 /llvm/lib/Transforms/IPO/FunctionImport.cpp
parent98a797c224a6abb2218963f551185ffba057aa4b (diff)
downloadbcm5719-llvm-5b2088d1fac1f464cd51d4b660b29c5db47a54c4.tar.gz
bcm5719-llvm-5b2088d1fac1f464cd51d4b660b29c5db47a54c4.zip
[ThinLTO] Use original alias visibility when importing
Summary: When we import an alias, we do so by making a clone of the aliasee. Just as this clone uses the original alias name and linkage, it should also use the same visibility (not the aliasee's visibility). Otherwise, linker behavior is affected (e.g. if the aliasee was hidden, but the alias is not, the resulting imported clone should not be hidden, otherwise the linker will make the final symbol hidden which is incorrect). Reviewers: wmi Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D62535 llvm-svn: 361989
Diffstat (limited to 'llvm/lib/Transforms/IPO/FunctionImport.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/FunctionImport.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp
index 71a76a6a67c..9207f5fe0ef 100644
--- a/llvm/lib/Transforms/IPO/FunctionImport.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp
@@ -1053,9 +1053,10 @@ static Function *replaceAliasWithAliasee(Module *SrcModule, GlobalAlias *GA) {
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;
OpenPOWER on IntegriCloud