[lld] r283787 - [LTO/Thin] Make the number of threads to run in the BE configurable.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 10 11:25:43 PDT 2016


We should expose this flag separately from the parallel LTO parallelism
level. See what we do in the gold plugin for example.

Peter

On Mon, Oct 10, 2016 at 11:12 AM, Davide Italiano via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: davide
> Date: Mon Oct 10 13:12:53 2016
> New Revision: 283787
>
> URL: http://llvm.org/viewvc/llvm-project?rev=283787&view=rev
> Log:
> [LTO/Thin] Make the number of threads to run in the BE configurable.
>
> Before the default was whatever number hardware_concurrency() returned.
> Users can specify the number of threads via --lto-jobs=X option.
>
> Added:
>     lld/trunk/test/ELF/lto/Inputs/thinlto.ll
>     lld/trunk/test/ELF/lto/thinlto.ll
> Modified:
>     lld/trunk/ELF/LTO.cpp
>
> Modified: lld/trunk/ELF/LTO.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LTO.cpp?
> rev=283787&r1=283786&r2=283787&view=diff
> ============================================================
> ==================
> --- lld/trunk/ELF/LTO.cpp (original)
> +++ lld/trunk/ELF/LTO.cpp Mon Oct 10 13:12:53 2016
> @@ -49,7 +49,6 @@ static void checkError(Error E) {
>
>  static std::unique_ptr<lto::LTO> createLTO() {
>    lto::Config Conf;
> -  lto::ThinBackend Backend;
>
>    // LLD supports the new relocations.
>    Conf.Options = InitTargetOptionsFromCodeGenFlags();
> @@ -68,6 +67,9 @@ static std::unique_ptr<lto::LTO> createL
>      checkError(Conf.addSaveTemps(std::string(Config->OutputFile) + ".",
>                              /*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);
>  }
>
>
> Added: lld/trunk/test/ELF/lto/Inputs/thinlto.ll
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/
> lto/Inputs/thinlto.ll?rev=283787&view=auto
> ============================================================
> ==================
> --- lld/trunk/test/ELF/lto/Inputs/thinlto.ll (added)
> +++ lld/trunk/test/ELF/lto/Inputs/thinlto.ll Mon Oct 10 13:12:53 2016
> @@ -0,0 +1,7 @@
> +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
> +target triple = "x86_64-unknown-linux-gnu"
> +
> +define void @g() {
> +entry:
> +  ret void
> +}
>
> Added: lld/trunk/test/ELF/lto/thinlto.ll
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/
> lto/thinlto.ll?rev=283787&view=auto
> ============================================================
> ==================
> --- lld/trunk/test/ELF/lto/thinlto.ll (added)
> +++ lld/trunk/test/ELF/lto/thinlto.ll Mon Oct 10 13:12:53 2016
> @@ -0,0 +1,29 @@
> +; Basic ThinLTO tests.
> +; RUN: llvm-as %s -o %t.o
> +; 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: 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: llvm-nm %t20.lto.o | FileCheck %s --check-prefix=NM1
> +; RUN: llvm-nm %t21.lto.o | FileCheck %s --check-prefix=NM2
> +
> +; NM1: T g
> +; NM2: T f
> +
> +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
> +target triple = "x86_64-unknown-linux-gnu"
> +
> +declare void @g(...)
> +
> +define void @f() {
> +entry:
> +  call void (...) @g()
> +  ret void
> +}
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>



-- 
-- 
Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161010/35bf64ca/attachment.html>


More information about the llvm-commits mailing list