[PATCH] D18702: [WIP/LTO] Improve internalize decisions
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 2 08:20:02 PDT 2016
ruiu added a subscriber: ruiu.
================
Comment at: ELF/LTO.cpp:78
@@ +77,3 @@
+ if (Config->Shared || Config->ExportDynamic) {
+ auto Visibility = Body->getVisibility();
+ if ((Visibility == llvm::ELF::STV_DEFAULT ||
----------------
We don't usually use `auto` if the type is obvious in a very narrow (e.g. RHS) context. We also use short names for variables with narrow scope, so I'd write
uint8_t V = Body->getVisibility();
return V == STV_DEFAULT || V == STV_PROTECTED;
================
Comment at: ELF/LTO.cpp:129-138
@@ -116,5 +128,12 @@
// the IRMover will just rename the symbol.
- // Shared libraries need to be handled slightly differently.
- // For now, let's be conservative and just never internalize
- // symbols when creating a shared library.
- if (!Config->Shared && !Config->ExportDynamic && !B->isUsedInRegularObj())
+ if (B->isUsedInRegularObj()) {
+ // Case 1: The symbol is referenced from the outside. We can't
+ // internalize this symbol.
+ Keep.push_back(GV);
+ } else if (isVisible(B)) {
+ // Case 2: The symbol is exported to the symbol table. Maybe we
+ // can internalize the symbol. So we put in a different set
+ // and we defer the decision after the mover did its job.
+ Keep.push_back(GV);
+ }
+ else {
----------------
In both cases it does the same thing. Is this intended?
Repository:
rL LLVM
http://reviews.llvm.org/D18702
More information about the llvm-commits
mailing list