[lld] r283817 - [LTO] Split the options for ThinLTO jobs and Regular LTO partitions
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 10 16:12:15 PDT 2016
Author: davide
Date: Mon Oct 10 18:12:14 2016
New Revision: 283817
URL: http://llvm.org/viewvc/llvm-project?rev=283817&view=rev
Log:
[LTO] Split the options for ThinLTO jobs and Regular LTO partitions
Differential Revision: https://reviews.llvm.org/D25452
Modified:
lld/trunk/ELF/Config.h
lld/trunk/ELF/Driver.cpp
lld/trunk/ELF/LTO.cpp
lld/trunk/ELF/Options.td
lld/trunk/test/ELF/basic.s
lld/trunk/test/ELF/lto/parallel-internalize.ll
lld/trunk/test/ELF/lto/parallel.ll
lld/trunk/test/ELF/lto/thinlto.ll
Modified: lld/trunk/ELF/Config.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Config.h?rev=283817&r1=283816&r2=283817&view=diff
==============================================================================
--- lld/trunk/ELF/Config.h (original)
+++ lld/trunk/ELF/Config.h Mon Oct 10 18:12:14 2016
@@ -138,9 +138,10 @@ struct Configuration {
uint64_t ImageBase;
uint64_t MaxPageSize;
uint64_t ZStackSize;
- unsigned LtoJobs;
+ unsigned LtoPartitions;
unsigned LtoO;
unsigned Optimize;
+ unsigned ThinLtoJobs;
};
// The only instance of Configuration struct.
Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=283817&r1=283816&r2=283817&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Mon Oct 10 18:12:14 2016
@@ -481,9 +481,12 @@ void LinkerDriver::readConfigs(opt::Inpu
Config->LtoO = getInteger(Args, OPT_lto_O, 2);
if (Config->LtoO > 3)
error("invalid optimization level for LTO: " + getString(Args, OPT_lto_O));
- Config->LtoJobs = getInteger(Args, OPT_lto_jobs, 1);
- if (Config->LtoJobs == 0)
- error("number of threads must be > 0");
+ Config->LtoPartitions = getInteger(Args, OPT_lto_partitions, 1);
+ if (Config->LtoPartitions == 0)
+ error("--lto-partitions: number of threads must be > 0");
+ Config->ThinLtoJobs = getInteger(Args, OPT_thinlto_jobs, -1u);
+ if (Config->ThinLtoJobs == 0)
+ error("--thinlto-jobs: number of threads must be > 0");
Config->ZCombreloc = !hasZOption(Args, "nocombreloc");
Config->ZExecStack = hasZOption(Args, "execstack");
Modified: lld/trunk/ELF/LTO.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LTO.cpp?rev=283817&r1=283816&r2=283817&view=diff
==============================================================================
--- lld/trunk/ELF/LTO.cpp (original)
+++ lld/trunk/ELF/LTO.cpp Mon Oct 10 18:12:14 2016
@@ -68,9 +68,10 @@ static std::unique_ptr<lto::LTO> createL
/*UseInputModulePath*/ true));
lto::ThinBackend Backend;
- if (Config->LtoJobs)
- Backend = lto::createInProcessThinBackend(Config->LtoJobs);
- return llvm::make_unique<lto::LTO>(std::move(Conf), Backend, Config->LtoJobs);
+ if (Config->ThinLtoJobs != -1u)
+ Backend = lto::createInProcessThinBackend(Config->ThinLtoJobs);
+ return llvm::make_unique<lto::LTO>(std::move(Conf), Backend,
+ Config->LtoPartitions);
}
BitcodeCompiler::BitcodeCompiler() : LtoObj(createLTO()) {}
Modified: lld/trunk/ELF/Options.td
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Options.td?rev=283817&r1=283816&r2=283817&view=diff
==============================================================================
--- lld/trunk/ELF/Options.td (original)
+++ lld/trunk/ELF/Options.td Mon Oct 10 18:12:14 2016
@@ -303,11 +303,13 @@ def alias_version_script_version_script:
Alias<version_script>;
// LTO-related options.
-def lto_jobs: J<"lto-jobs=">, HelpText<"Number of threads to run codegen">;
def lto_aa_pipeline: J<"lto-aa-pipeline=">,
HelpText<"AA pipeline to run during LTO. Used in conjunction with -lto-newpm-passes">;
def lto_newpm_passes: J<"lto-newpm-passes=">,
HelpText<"Passes to run during LTO">;
+def lto_partitions: J<"lto-partitions=">,
+ HelpText<"Number of LTO codegen partitions">;
def disable_verify: F<"disable-verify">;
def mllvm: S<"mllvm">;
def save_temps: F<"save-temps">;
+def thinlto_jobs: J<"thinlto-jobs=">, HelpText<"Number of ThinLTO jobs">;
Modified: lld/trunk/test/ELF/basic.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/basic.s?rev=283817&r1=283816&r2=283817&view=diff
==============================================================================
--- lld/trunk/test/ELF/basic.s (original)
+++ lld/trunk/test/ELF/basic.s Mon Oct 10 18:12:14 2016
@@ -226,5 +226,8 @@ _start:
# RUN: not ld.lld %t -o %t -m wrong_emul_fbsd 2>&1 | FileCheck --check-prefix=UNKNOWN_EMUL %s
# UNKNOWN_EMUL: unknown emulation: wrong_emul_fbsd
-# RUN: not ld.lld %t --lto-jobs=0 2>&1 | FileCheck --check-prefix=NOTHREADS %s
-# NOTHREADS: number of threads must be > 0
+# RUN: not ld.lld %t --lto-partitions=0 2>&1 | FileCheck --check-prefix=NOTHREADS %s
+# NOTHREADS: --lto-partitions: number of threads must be > 0
+
+# RUN: not ld.lld %t --thinlto-jobs=0 2>&1 | FileCheck --check-prefix=NOTHREADSTHIN %s
+# NOTHREADSTHIN: --thinlto-jobs: number of threads must be > 0
Modified: lld/trunk/test/ELF/lto/parallel-internalize.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto/parallel-internalize.ll?rev=283817&r1=283816&r2=283817&view=diff
==============================================================================
--- lld/trunk/test/ELF/lto/parallel-internalize.ll (original)
+++ lld/trunk/test/ELF/lto/parallel-internalize.ll Mon Oct 10 18:12:14 2016
@@ -1,6 +1,7 @@
; REQUIRES: x86
; RUN: llvm-as -o %t.bc %s
-; RUN: ld.lld -m elf_x86_64 --lto-jobs=2 -save-temps -o %t %t.bc -e foo --lto-O0
+; RUN: ld.lld -m elf_x86_64 --lto-partitions=2 -save-temps -o %t %t.bc \
+; RUN: -e foo --lto-O0
; RUN: llvm-readobj -t -dyn-symbols %t | FileCheck %s
; RUN: llvm-nm %t0.lto.o | FileCheck --check-prefix=CHECK0 %s
; RUN: llvm-nm %t1.lto.o | FileCheck --check-prefix=CHECK1 %s
Modified: lld/trunk/test/ELF/lto/parallel.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto/parallel.ll?rev=283817&r1=283816&r2=283817&view=diff
==============================================================================
--- lld/trunk/test/ELF/lto/parallel.ll (original)
+++ lld/trunk/test/ELF/lto/parallel.ll Mon Oct 10 18:12:14 2016
@@ -1,6 +1,6 @@
; REQUIRES: x86
; RUN: llvm-as -o %t.bc %s
-; RUN: ld.lld -m elf_x86_64 --lto-jobs=2 -save-temps -o %t %t.bc -shared
+; RUN: ld.lld -m elf_x86_64 --lto-partitions=2 -save-temps -o %t %t.bc -shared
; RUN: llvm-nm %t0.lto.o | FileCheck --check-prefix=CHECK0 %s
; RUN: llvm-nm %t1.lto.o | FileCheck --check-prefix=CHECK1 %s
Modified: lld/trunk/test/ELF/lto/thinlto.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto/thinlto.ll?rev=283817&r1=283816&r2=283817&view=diff
==============================================================================
--- lld/trunk/test/ELF/lto/thinlto.ll (original)
+++ lld/trunk/test/ELF/lto/thinlto.ll Mon Oct 10 18:12:14 2016
@@ -3,14 +3,14 @@
; RUN: llvm-as %p/Inputs/thinlto.ll -o %t2.o
; First force single-threaded mode
-; RUN: ld.lld -save-temps --lto-jobs=1 -shared %t.o %t2.o -o %t
+; RUN: ld.lld -save-temps --thinlto-jobs=1 -shared %t.o %t2.o -o %t
; RUN: llvm-nm %t.lto.o | FileCheck %s --check-prefix=NM
; NM: T f
; NM: T g
; Next force multi-threaded mode
-; RUN: ld.lld -save-temps --lto-jobs=2 -shared %t.o %t2.o -o %t2
+; RUN: ld.lld -save-temps --thinlto-jobs=2 -shared %t.o %t2.o -o %t2
; RUN: llvm-nm %t20.lto.o | FileCheck %s --check-prefix=NM1
; RUN: llvm-nm %t21.lto.o | FileCheck %s --check-prefix=NM2
More information about the llvm-commits
mailing list