[llvm] r270600 - [ThinLTO] Handle empty exports list for module.

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Tue May 24 12:12:49 PDT 2016


Author: tejohnson
Date: Tue May 24 14:12:48 2016
New Revision: 270600

URL: http://llvm.org/viewvc/llvm-project?rev=270600&view=rev
Log:
[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.

Modified:
    llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp

Modified: llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp?rev=270600&r1=270599&r2=270600&view=diff
==============================================================================
--- llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp (original)
+++ llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp Tue May 24 14:12:48 2016
@@ -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(M
   // 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




More information about the llvm-commits mailing list