diff options
| author | Mehdi Amini <mehdi.amini@apple.com> | 2017-02-03 00:32:38 +0000 |
|---|---|---|
| committer | Mehdi Amini <mehdi.amini@apple.com> | 2017-02-03 00:32:38 +0000 |
| commit | b0a8ff71e543ad01bdb684866176a63e72a472f8 (patch) | |
| tree | 0518ef60c2a529b2e728681c0bf99c613d7ac710 /llvm/lib/Transforms | |
| parent | bbb2b95ce54e1bde4e2df42969876d22a7415daf (diff) | |
| download | bcm5719-llvm-b0a8ff71e543ad01bdb684866176a63e72a472f8.tar.gz bcm5719-llvm-b0a8ff71e543ad01bdb684866176a63e72a472f8.zip | |
[ThinLTO] Add an auto-hide feature
When a symbol is not exported outside of the
DSO, it is can be hidden. Usually we try to internalize
as much as possible, but it is not always possible, for
instance a symbol can be referenced outside of the LTO
unit, or there can be cross-module reference in ThinLTO.
This is a recommit of r293912 after fixing build failures,
and a recommit of r293918 after fixing LLD tests.
Differential Revision: https://reviews.llvm.org/D28978
llvm-svn: 293970
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/IPO/FunctionImport.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp index 5fa99863135..2966be2d46d 100644 --- a/llvm/lib/Transforms/IPO/FunctionImport.cpp +++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp @@ -644,6 +644,13 @@ void llvm::thinLTOInternalizeModule(Module &TheModule, return !GlobalValue::isLocalLinkage(Linkage); }; + // Try to auto-hide the symbols. + for (auto &GO : TheModule.global_objects()) { + const auto &GS = DefinedGlobals.find(GO.getGUID()); + if (GS != DefinedGlobals.end() && GS->second->flags().AutoHide) + GO.setVisibility(GlobalValue::HiddenVisibility); + } + // FIXME: See if we can just internalize directly here via linkage changes // based on the index, rather than invoking internalizeModule. llvm::internalizeModule(TheModule, MustPreserveGV); |

