Skip to content

Commit

Permalink
[ThinLTO] Don't perform computeDeadSymbols during O0 link, as the res…
Browse files Browse the repository at this point in the history
…ult is never used (NFC)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292679 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
joker-eph committed Jan 20, 2017
1 parent 38596a9 commit cf0c9c5
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions lib/LTO/LTO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -856,26 +856,26 @@ Error LTO::runThinLTO(AddStreamFn AddStream, NativeObjectCache Cache,
if (!ModuleToDefinedGVSummaries.count(Mod.first))
ModuleToDefinedGVSummaries.try_emplace(Mod.first);

// Compute "dead" symbols, we don't want to import/export these!
DenseSet<GlobalValue::GUID> GUIDPreservedSymbols;
for (auto &Res : GlobalResolutions) {
if (Res.second.VisibleOutsideThinLTO &&
// IRName will be defined if we have seen the prevailing copy of
// this value. If not, no need to preserve any ThinLTO copies.
!Res.second.IRName.empty())
GUIDPreservedSymbols.insert(GlobalValue::getGUID(Res.second.IRName));
}

auto DeadSymbols =
computeDeadSymbols(ThinLTO.CombinedIndex, GUIDPreservedSymbols);

StringMap<FunctionImporter::ImportMapTy> ImportLists(
ThinLTO.ModuleMap.size());
StringMap<FunctionImporter::ExportSetTy> ExportLists(
ThinLTO.ModuleMap.size());
StringMap<std::map<GlobalValue::GUID, GlobalValue::LinkageTypes>> ResolvedODR;

if (Conf.OptLevel > 0) {
// Compute "dead" symbols, we don't want to import/export these!
DenseSet<GlobalValue::GUID> GUIDPreservedSymbols;
for (auto &Res : GlobalResolutions) {
if (Res.second.VisibleOutsideThinLTO &&
// IRName will be defined if we have seen the prevailing copy of
// this value. If not, no need to preserve any ThinLTO copies.
!Res.second.IRName.empty())
GUIDPreservedSymbols.insert(GlobalValue::getGUID(Res.second.IRName));
}

auto DeadSymbols =
computeDeadSymbols(ThinLTO.CombinedIndex, GUIDPreservedSymbols);

ComputeCrossModuleImport(ThinLTO.CombinedIndex, ModuleToDefinedGVSummaries,
ImportLists, ExportLists, &DeadSymbols);

Expand Down

0 comments on commit cf0c9c5

Please sign in to comment.