Index: ELF/Config.h =================================================================== --- ELF/Config.h +++ ELF/Config.h @@ -138,9 +138,10 @@ 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. Index: ELF/Driver.cpp =================================================================== --- ELF/Driver.cpp +++ ELF/Driver.cpp @@ -481,9 +481,12 @@ 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, 1); + if (Config->ThinLtoJobs == 0) + error("--thinlto-jobs: number of threads must be > 0"); Config->ZCombreloc = !hasZOption(Args, "nocombreloc"); Config->ZExecStack = hasZOption(Args, "execstack"); Index: ELF/LTO.cpp =================================================================== --- ELF/LTO.cpp +++ ELF/LTO.cpp @@ -68,9 +68,10 @@ /*UseInputModulePath*/ true)); lto::ThinBackend Backend; - if (Config->LtoJobs) - Backend = lto::createInProcessThinBackend(Config->LtoJobs); - return llvm::make_unique(std::move(Conf), Backend, Config->LtoJobs); + if (Config->ThinLtoJobs) + Backend = lto::createInProcessThinBackend(Config->ThinLtoJobs); + return llvm::make_unique(std::move(Conf), Backend, + Config->LtoPartitions); } BitcodeCompiler::BitcodeCompiler() : LtoObj(createLTO()) {} Index: ELF/Options.td =================================================================== --- ELF/Options.td +++ ELF/Options.td @@ -303,11 +303,13 @@ Alias; // 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">; Index: test/ELF/basic.s =================================================================== --- test/ELF/basic.s +++ test/ELF/basic.s @@ -226,5 +226,8 @@ # 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 Index: test/ELF/lto/parallel-internalize.ll =================================================================== --- test/ELF/lto/parallel-internalize.ll +++ test/ELF/lto/parallel-internalize.ll @@ -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 Index: test/ELF/lto/parallel.ll =================================================================== --- test/ELF/lto/parallel.ll +++ test/ELF/lto/parallel.ll @@ -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 Index: test/ELF/lto/thinlto.ll =================================================================== --- test/ELF/lto/thinlto.ll +++ test/ELF/lto/thinlto.ll @@ -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