summaryrefslogtreecommitdiff
path: root/lib/LTO/LTOBackend.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2016-12-14 01:17:59 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2016-12-14 01:17:59 +0000
commit08850161ecdeeb7bb1308e8b27ee112152e56727 (patch)
treeddf95a8bfacc69a7530f32e44c7105887d7c7536 /lib/LTO/LTOBackend.cpp
parentd5f6cc37da95b9a327bf7952993ff4b6e20eaf79 (diff)
LTO: Add support for multi-module bitcode files.
Differential Revision: https://reviews.llvm.org/D27313 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289621 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/LTO/LTOBackend.cpp')
-rw-r--r--lib/LTO/LTOBackend.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/LTO/LTOBackend.cpp b/lib/LTO/LTOBackend.cpp
index ad76e717981..9d4cbdde3ff 100644
--- a/lib/LTO/LTOBackend.cpp
+++ b/lib/LTO/LTOBackend.cpp
@@ -318,7 +318,7 @@ Error lto::thinBackend(Config &Conf, unsigned Task, AddStreamFn AddStream,
Module &Mod, ModuleSummaryIndex &CombinedIndex,
const FunctionImporter::ImportMapTy &ImportList,
const GVSummaryMapTy &DefinedGlobals,
- MapVector<StringRef, MemoryBufferRef> &ModuleMap) {
+ MapVector<StringRef, BitcodeModule> &ModuleMap) {
Expected<const Target *> TOrErr = initAndLookupTarget(Conf, Mod);
if (!TOrErr)
return TOrErr.takeError();
@@ -353,8 +353,10 @@ Error lto::thinBackend(Config &Conf, unsigned Task, AddStreamFn AddStream,
auto ModuleLoader = [&](StringRef Identifier) {
assert(Mod.getContext().isODRUniquingDebugTypes() &&
"ODR Type uniquing should be enabled on the context");
- return getLazyBitcodeModule(ModuleMap[Identifier], Mod.getContext(),
- /*ShouldLazyLoadMetadata=*/true);
+ auto I = ModuleMap.find(Identifier);
+ assert(I != ModuleMap.end());
+ return I->second.getLazyModule(Mod.getContext(),
+ /*ShouldLazyLoadMetadata=*/true);
};
FunctionImporter Importer(CombinedIndex, ModuleLoader);