From dbd2fed6a1a1ae2efb64255fdd0e07a04a2d1f13 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Thu, 15 Jun 2017 17:26:13 +0000 Subject: 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 --- llvm/lib/IR/ModuleSummaryIndex.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'llvm/lib/IR/ModuleSummaryIndex.cpp') diff --git a/llvm/lib/IR/ModuleSummaryIndex.cpp b/llvm/lib/IR/ModuleSummaryIndex.cpp index 9dd712f9ca1..721d4d47e36 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; +} -- cgit v1.2.3