diff options
author | Davide Italiano <davide@freebsd.org> | 2016-10-10 18:12:53 +0000 |
---|---|---|
committer | Davide Italiano <davide@freebsd.org> | 2016-10-10 18:12:53 +0000 |
commit | 7a7b35ae3bbd5037d920146f29048f804921c5cb (patch) | |
tree | 69d4238149c2a607544098a929aac9c7dac60208 | |
parent | b224c048b4e79369d16a86b04f15e40c19f78497 (diff) | |
download | bcm5719-llvm-7a7b35ae3bbd5037d920146f29048f804921c5cb.tar.gz bcm5719-llvm-7a7b35ae3bbd5037d920146f29048f804921c5cb.zip |
[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.
llvm-svn: 283787
-rw-r--r-- | lld/ELF/LTO.cpp | 4 | ||||
-rw-r--r-- | lld/test/ELF/lto/Inputs/thinlto.ll | 7 | ||||
-rw-r--r-- | lld/test/ELF/lto/thinlto.ll | 29 |
3 files changed, 39 insertions, 1 deletions
diff --git a/lld/ELF/LTO.cpp b/lld/ELF/LTO.cpp index 9c7de9d613d..ede80c24653 100644 --- a/lld/ELF/LTO.cpp +++ b/lld/ELF/LTO.cpp @@ -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> createLTO() { 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); } diff --git a/lld/test/ELF/lto/Inputs/thinlto.ll b/lld/test/ELF/lto/Inputs/thinlto.ll new file mode 100644 index 00000000000..31c72ec4653 --- /dev/null +++ b/lld/test/ELF/lto/Inputs/thinlto.ll @@ -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 +} diff --git a/lld/test/ELF/lto/thinlto.ll b/lld/test/ELF/lto/thinlto.ll new file mode 100644 index 00000000000..98d4aff2f99 --- /dev/null +++ b/lld/test/ELF/lto/thinlto.ll @@ -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 +} |