[PATCH] D23579: [ThinLTO] Adapt backend invocation to llvm API changes.
Mehdi AMINI via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 16 14:08:02 PDT 2016
mehdi_amini created this revision.
mehdi_amini added a reviewer: tejohnson.
mehdi_amini added a subscriber: llvm-commits.
Herald added a subscriber: mehdi_amini.
https://reviews.llvm.org/D23579
Files:
lib/CodeGen/BackendUtil.cpp
Index: lib/CodeGen/BackendUtil.cpp
===================================================================
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -723,6 +723,20 @@
}
}
+namespace {
+// Wrapper prodiving a stream for the ThinLTO backend.
+class ThinLTOOutputWrapper : public lto::NativeObjectOutput {
+ std::unique_ptr<raw_pwrite_stream> OS;
+
+public:
+ ThinLTOOutputWrapper(std::unique_ptr<raw_pwrite_stream> OS)
+ : OS(std::move(OS)) {}
+ std::unique_ptr<raw_pwrite_stream> getStream() override {
+ return std::move(OS);
+ }
+};
+}
+
static void runThinLTOBackend(const CodeGenOptions &CGOpts, Module *M,
std::unique_ptr<raw_pwrite_stream> OS) {
// If we are performing a ThinLTO importing compile, load the function index
@@ -740,8 +754,6 @@
}
std::unique_ptr<ModuleSummaryIndex> CombinedIndex = std::move(*IndexOrErr);
- auto AddStream = [&](size_t Task) { return std::move(OS); };
-
StringMap<std::map<GlobalValue::GUID, GlobalValueSummary *>>
ModuleToDefinedGVSummaries;
CombinedIndex->collectDefinedGVSummariesPerModule(ModuleToDefinedGVSummaries);
@@ -766,10 +778,12 @@
ModuleMap[I.first()] = (*MBOrErr)->getMemBufferRef();
OwnedImports.push_back(std::move(*MBOrErr));
}
-
+ auto AddOutput = [&](size_t Task) {
+ return llvm::make_unique<ThinLTOOutputWrapper>(std::move(OS));
+ };
lto::Config Conf;
if (Error E = thinBackend(
- Conf, 0, AddStream, *M, *CombinedIndex, ImportList,
+ Conf, 0, AddOutput, *M, *CombinedIndex, ImportList,
ModuleToDefinedGVSummaries[M->getModuleIdentifier()], ModuleMap)) {
handleAllErrors(std::move(E), [&](ErrorInfoBase &EIB) {
errs() << "Error running ThinLTO backend: " << EIB.message() << '\n';
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23579.68252.patch
Type: text/x-patch
Size: 1800 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160816/1bff62f1/attachment.bin>
More information about the llvm-commits
mailing list