Index: lib/CodeGen/BackendUtil.cpp =================================================================== --- lib/CodeGen/BackendUtil.cpp +++ lib/CodeGen/BackendUtil.cpp @@ -1038,23 +1038,8 @@ // we should only invoke this using the individual indexes written out // via a WriteIndexesThinBackend. FunctionImporter::ImportMapTy ImportList; - for (auto &GlobalList : *CombinedIndex) { - // Ignore entries for undefined references. - if (GlobalList.second.SummaryList.empty()) - continue; - - auto GUID = GlobalList.first; - assert(GlobalList.second.SummaryList.size() == 1 && - "Expected individual combined index to have one summary per GUID"); - auto &Summary = GlobalList.second.SummaryList[0]; - // Skip the summaries for the importing module. These are included to - // e.g. record required linkage changes. - if (Summary->modulePath() == M->getModuleIdentifier()) - continue; - // Doesn't matter what value we plug in to the map, just needs an entry - // to provoke importing by thinBackend. - ImportList[Summary->modulePath()][GUID] = 1; - } + llvm::ComputeCrossModuleImportForModuleFromIndex(M->getModuleIdentifier(), + *CombinedIndex, ImportList); std::vector> OwnedImports; MapVector ModuleMap;