[ThinLTO] Handle empty exports list for module.

We might have an empty exports list for a module and shouldn't assert
when checking if a symbol is exported.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270600 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Teresa Johnson 2016-05-24 19:12:48 +00:00
parent 7e463431d7
commit d2a4b77f78

View File

@ -586,8 +586,9 @@ static void resolveWeakForLinkerInIndex(
auto isExported = [&](StringRef ModuleIdentifier, GlobalValue::GUID GUID) {
const auto &ExportList = ExportLists.find(ModuleIdentifier);
assert(ExportList != ExportLists.end() && "Missing export list for module");
return ExportList->second.count(GUID) || GUIDPreservedSymbols.count(GUID);
return (ExportList != ExportLists.end() &&
ExportList->second.count(GUID)) ||
GUIDPreservedSymbols.count(GUID);
};
auto recordNewLinkage = [&](StringRef ModuleIdentifier,
@ -827,8 +828,9 @@ void ThinLTOCodeGenerator::internalize(Module &TheModule,
// Internalization
auto isExported = [&](StringRef ModuleIdentifier, GlobalValue::GUID GUID) {
const auto &ExportList = ExportLists.find(ModuleIdentifier);
assert(ExportList != ExportLists.end() && "Missing export list for module");
return ExportList->second.count(GUID) || GUIDPreservedSymbols.count(GUID);
return (ExportList != ExportLists.end() &&
ExportList->second.count(GUID)) ||
GUIDPreservedSymbols.count(GUID);
};
thinLTOInternalizeAndPromoteInIndex(Index, isExported);
thinLTOInternalizeModule(TheModule,
@ -928,8 +930,9 @@ void ThinLTOCodeGenerator::run() {
auto isExported = [&](StringRef ModuleIdentifier, GlobalValue::GUID GUID) {
const auto &ExportList = ExportLists.find(ModuleIdentifier);
assert(ExportList != ExportLists.end() && "Missing export list for module");
return ExportList->second.count(GUID) || GUIDPreservedSymbols.count(GUID);
return (ExportList != ExportLists.end() &&
ExportList->second.count(GUID)) ||
GUIDPreservedSymbols.count(GUID);
};
// Use global summary-based analysis to identify symbols that can be