aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/ModuleSummaryIndex.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2017-06-15 17:26:13 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2017-06-15 17:26:13 +0000
commitdbd2fed6a1a1ae2efb64255fdd0e07a04a2d1f13 (patch)
tree5b04d233e36a1de3205dcd20c07e890c20fb76c0 /llvm/lib/IR/ModuleSummaryIndex.cpp
parent587525468d4fc61902965476051019b20fd1621e (diff)
downloadllvm-dbd2fed6a1a1ae2efb64255fdd0e07a04a2d1f13.zip
llvm-dbd2fed6a1a1ae2efb64255fdd0e07a04a2d1f13.tar.gz
llvm-dbd2fed6a1a1ae2efb64255fdd0e07a04a2d1f13.tar.bz2
Apply summary-based dead stripping to regular LTO modules with summaries.
If a regular LTO module has a summary index, then instead of linking it into the combined regular LTO module right away, add it to the combined summary index and associate it with a special module that represents the combined regular LTO module. Any such modules are linked during LTO::run(), at which time we use the results of summary-based dead stripping to control whether to link prevailing symbols. Differential Revision: https://reviews.llvm.org/D33922 llvm-svn: 305482
Diffstat (limited to 'llvm/lib/IR/ModuleSummaryIndex.cpp')
-rw-r--r--llvm/lib/IR/ModuleSummaryIndex.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/IR/ModuleSummaryIndex.cpp b/llvm/lib/IR/ModuleSummaryIndex.cpp
index 9dd712f..721d4d47 100644
--- a/llvm/lib/IR/ModuleSummaryIndex.cpp
+++ b/llvm/lib/IR/ModuleSummaryIndex.cpp
@@ -56,3 +56,13 @@ ModuleSummaryIndex::getGlobalValueSummary(uint64_t ValueGUID,
auto &Summary = VI.getSummaryList()[0];
return Summary.get();
}
+
+bool ModuleSummaryIndex::isGUIDLive(GlobalValue::GUID GUID) const {
+ auto VI = getValueInfo(GUID);
+ if (!VI)
+ return false;
+ for (auto &I : VI.getSummaryList())
+ if (isGlobalValueLive(I.get()))
+ return true;
+ return false;
+}