diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2017-06-01 20:30:06 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2017-06-01 20:30:06 +0000 |
commit | 56584bbf16d70fbf2f07b5ce1a2fbf15f447abe5 (patch) | |
tree | a5cf460521bbe07a6f3e1d0799bd71a7a806e8eb /llvm/lib/LTO/LTO.cpp | |
parent | a5dbbc6eada042cc86628da235829b715cec543d (diff) | |
download | llvm-56584bbf16d70fbf2f07b5ce1a2fbf15f447abe5.zip llvm-56584bbf16d70fbf2f07b5ce1a2fbf15f447abe5.tar.gz llvm-56584bbf16d70fbf2f07b5ce1a2fbf15f447abe5.tar.bz2 |
(NFC) Track global summary liveness in GVFlags.
Replace GVFlags::LiveRoot with GVFlags::Live and use that instead of
all the DeadSymbols sets. This is refactoring in order to make
liveness information available in the RegularLTO pipeline.
llvm-svn: 304466
Diffstat (limited to 'llvm/lib/LTO/LTO.cpp')
-rw-r--r-- | llvm/lib/LTO/LTO.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp index 9efc095..b8698c8 100644 --- a/llvm/lib/LTO/LTO.cpp +++ b/llvm/lib/LTO/LTO.cpp @@ -930,6 +930,17 @@ ThinBackend lto::createWriteIndexesThinBackend(std::string OldPrefix, }; } +static bool IsLiveByGUID(const ModuleSummaryIndex &Index, + GlobalValue::GUID GUID) { + auto VI = Index.getValueInfo(GUID); + if (!VI) + return false; + for (auto &I : VI.getSummaryList()) + if (Index.isGlobalValueLive(I.get())) + return true; + return false; +} + Error LTO::runThinLTO(AddStreamFn AddStream, NativeObjectCache Cache, bool HasRegularLTO) { if (ThinLTO.ModuleMap.empty()) @@ -973,11 +984,10 @@ Error LTO::runThinLTO(AddStreamFn AddStream, NativeObjectCache Cache, GlobalValue::dropLLVMManglingEscape(Res.second.IRName))); } - auto DeadSymbols = - computeDeadSymbols(ThinLTO.CombinedIndex, GUIDPreservedSymbols); + computeDeadSymbols(ThinLTO.CombinedIndex, GUIDPreservedSymbols); ComputeCrossModuleImport(ThinLTO.CombinedIndex, ModuleToDefinedGVSummaries, - ImportLists, ExportLists, &DeadSymbols); + ImportLists, ExportLists); std::set<GlobalValue::GUID> ExportedGUIDs; for (auto &Res : GlobalResolutions) { @@ -992,7 +1002,7 @@ Error LTO::runThinLTO(AddStreamFn AddStream, NativeObjectCache Cache, auto GUID = GlobalValue::getGUID( GlobalValue::dropLLVMManglingEscape(Res.second.IRName)); // Mark exported unless index-based analysis determined it to be dead. - if (!DeadSymbols.count(GUID)) + if (IsLiveByGUID(ThinLTO.CombinedIndex, GUID)) ExportedGUIDs.insert(GUID); } |