diff options
author | Teresa Johnson <tejohnson@google.com> | 2016-09-16 13:54:19 +0000 |
---|---|---|
committer | Teresa Johnson <tejohnson@google.com> | 2016-09-16 13:54:19 +0000 |
commit | 8dd61aee30541523012e713f15152744a7222e90 (patch) | |
tree | 6d84e3000f904069ca1cd6598ba3168be2206795 /llvm/lib/LTO/LTO.cpp | |
parent | cf060794cd4da110c96530f437f2f2586347b1f3 (diff) | |
download | bcm5719-llvm-8dd61aee30541523012e713f15152744a7222e90.tar.gz bcm5719-llvm-8dd61aee30541523012e713f15152744a7222e90.zip |
[LTO] Fix handling of mixed (regular and thin) mode LTO
Summary:
In runThinLTO we start the task numbering for ThinLTO backend
tasks depending on whether there was also a regular LTO object
(CombinedModule). However, the CombinedModule is moved at
the end of runRegularLTO, so we need to save this information and
pass it into runThinLTO. Otherwise the AddOutput callback to the client
will use the same task number for both the regular LTO object
and the first ThinLTO object, which in gold-plugin caused only
one to be end up in the output filename array and therefore passed
back to gold for the final native link.
Reviewers: pcc, mehdi_amini
Subscribers: mehdi_amini, kromanova
Differential Revision: https://reviews.llvm.org/D24643
llvm-svn: 281725
Diffstat (limited to 'llvm/lib/LTO/LTO.cpp')
-rw-r--r-- | llvm/lib/LTO/LTO.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp index a1c287a10ad..0d47cd49a17 100644 --- a/llvm/lib/LTO/LTO.cpp +++ b/llvm/lib/LTO/LTO.cpp @@ -410,11 +410,15 @@ unsigned LTO::getMaxTasks() const { } Error LTO::run(AddOutputFn AddOutput) { + // Save the status of having a regularLTO combined module, as + // this is needed for generating the ThinLTO Task ID, and + // the CombinedModule will be moved at the end of runRegularLTO. + bool HasRegularLTO = RegularLTO.CombinedModule != nullptr; // Invoke regular LTO if there was a regular LTO module to start with. - if (RegularLTO.CombinedModule) + if (HasRegularLTO) if (auto E = runRegularLTO(AddOutput)) return E; - return runThinLTO(AddOutput); + return runThinLTO(AddOutput, HasRegularLTO); } Error LTO::runRegularLTO(AddOutputFn AddOutput) { @@ -696,7 +700,7 @@ ThinBackend lto::createWriteIndexesThinBackend(std::string OldPrefix, }; } -Error LTO::runThinLTO(AddOutputFn AddOutput) { +Error LTO::runThinLTO(AddOutputFn AddOutput, bool HasRegularLTO) { if (ThinLTO.ModuleMap.empty()) return Error(); @@ -753,9 +757,8 @@ Error LTO::runThinLTO(AddOutputFn AddOutput) { // ParallelCodeGenParallelismLevel if an LTO module is present, as tasks 0 // through ParallelCodeGenParallelismLevel-1 are reserved for parallel code // generation partitions. - unsigned Task = RegularLTO.CombinedModule - ? RegularLTO.ParallelCodeGenParallelismLevel - : 0; + unsigned Task = + HasRegularLTO ? RegularLTO.ParallelCodeGenParallelismLevel : 0; unsigned Partition = 1; for (auto &Mod : ThinLTO.ModuleMap) { |