summaryrefslogtreecommitdiffstats
path: root/llvm/lib/LTO
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2017-05-01 22:04:36 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2017-05-01 22:04:36 +0000
commit74d22dd7dc608675486f166918b4d4369d79c88b (patch)
tree52b89971135c28dae9a2be39c73765a79a2a3c76 /llvm/lib/LTO
parent864a363e8f4e2ea59cd4c9a6561ab0707546f6ce (diff)
downloadbcm5719-llvm-74d22dd7dc608675486f166918b4d4369d79c88b.tar.gz
bcm5719-llvm-74d22dd7dc608675486f166918b4d4369d79c88b.zip
Bitcode: Make the summary reader responsible for merging. NFCI.
This is to prepare for an upcoming change which uses pointers instead of GUIDs to represent references. Differential Revision: https://reviews.llvm.org/D32469 llvm-svn: 301843
Diffstat (limited to 'llvm/lib/LTO')
-rw-r--r--llvm/lib/LTO/LTO.cpp8
-rw-r--r--llvm/lib/LTO/ThinLTOCodeGenerator.cpp15
2 files changed, 8 insertions, 15 deletions
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index cc3d96401ab..0afa1ba6ecd 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -591,11 +591,9 @@ Error LTO::addThinLTO(BitcodeModule BM,
ArrayRef<InputFile::Symbol> Syms,
const SymbolResolution *&ResI,
const SymbolResolution *ResE) {
- Expected<std::unique_ptr<ModuleSummaryIndex>> SummaryOrErr = BM.getSummary();
- if (!SummaryOrErr)
- return SummaryOrErr.takeError();
- ThinLTO.CombinedIndex.mergeFrom(std::move(*SummaryOrErr),
- ThinLTO.ModuleMap.size());
+ if (Error Err =
+ BM.readSummary(ThinLTO.CombinedIndex, ThinLTO.ModuleMap.size()))
+ return Err;
for (const InputFile::Symbol &Sym : Syms) {
assert(ResI != ResE);
diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
index d2fc892d6a9..440275c3425 100644
--- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
@@ -565,23 +565,18 @@ std::unique_ptr<TargetMachine> TargetMachineBuilder::create() const {
* "thin-link".
*/
std::unique_ptr<ModuleSummaryIndex> ThinLTOCodeGenerator::linkCombinedIndex() {
- std::unique_ptr<ModuleSummaryIndex> CombinedIndex;
+ std::unique_ptr<ModuleSummaryIndex> CombinedIndex =
+ llvm::make_unique<ModuleSummaryIndex>();
uint64_t NextModuleId = 0;
for (auto &ModuleBuffer : Modules) {
- Expected<std::unique_ptr<ModuleSummaryIndex>> IndexOrErr =
- getModuleSummaryIndex(ModuleBuffer.getMemBuffer());
- if (!IndexOrErr) {
+ if (Error Err = readModuleSummaryIndex(ModuleBuffer.getMemBuffer(),
+ *CombinedIndex, NextModuleId++)) {
// FIXME diagnose
logAllUnhandledErrors(
- IndexOrErr.takeError(), errs(),
+ std::move(Err), errs(),
"error: can't create module summary index for buffer: ");
return nullptr;
}
- if (CombinedIndex) {
- CombinedIndex->mergeFrom(std::move(*IndexOrErr), ++NextModuleId);
- } else {
- CombinedIndex = std::move(*IndexOrErr);
- }
}
return CombinedIndex;
}
OpenPOWER on IntegriCloud