aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/LTO/LTO.cpp
diff options
context:
space:
mode:
authorEugene Leviant <eleviant@accesssoftek.com>2018-11-10 08:31:21 +0000
committerEugene Leviant <eleviant@accesssoftek.com>2018-11-10 08:31:21 +0000
commitbe8d19967aeae0eba3b82c0ec808b441327189c8 (patch)
tree242e575b70608bf6000b8555863c2c7a310d4e17 /llvm/lib/LTO/LTO.cpp
parent825f9d3e268ce39d057f6d3772a23de6fe407f0d (diff)
downloadllvm-be8d19967aeae0eba3b82c0ec808b441327189c8.zip
llvm-be8d19967aeae0eba3b82c0ec808b441327189c8.tar.gz
llvm-be8d19967aeae0eba3b82c0ec808b441327189c8.tar.bz2
[ThinLTO] Internalize readonly globals
This patch allows internalising globals if all accesses to them (from live functions) are from non-volatile load instructions Differential revision: https://reviews.llvm.org/D49362 llvm-svn: 346584
Diffstat (limited to 'llvm/lib/LTO/LTO.cpp')
-rw-r--r--llvm/lib/LTO/LTO.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index 6b11f69..68fd93a 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -187,6 +187,8 @@ static void computeCacheKey(
AddUnsigned(VI.isDSOLocal());
AddUsedCfiGlobal(VI.getGUID());
}
+ if (auto *GVS = dyn_cast<GlobalVarSummary>(GS))
+ AddUnsigned(GVS->isReadOnly());
if (auto *FS = dyn_cast<FunctionSummary>(GS)) {
for (auto &TT : FS->type_tests())
UsedTypeIds.insert(TT);
@@ -809,7 +811,8 @@ Error LTO::run(AddStreamFn AddStream, NativeObjectCache Cache) {
return PrevailingType::Unknown;
return It->second;
};
- computeDeadSymbols(ThinLTO.CombinedIndex, GUIDPreservedSymbols, isPrevailing);
+ computeDeadSymbolsWithConstProp(ThinLTO.CombinedIndex, GUIDPreservedSymbols,
+ isPrevailing, Conf.OptLevel > 0);
// Setup output file to emit statistics.
std::unique_ptr<ToolOutputFile> StatsFile = nullptr;