forked from OSchip/llvm-project
[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
This commit is contained in:
parent
b224c048b4
commit
7a7b35ae3b
|
@ -49,7 +49,6 @@ static void checkError(Error E) {
|
||||||
|
|
||||||
static std::unique_ptr<lto::LTO> createLTO() {
|
static std::unique_ptr<lto::LTO> createLTO() {
|
||||||
lto::Config Conf;
|
lto::Config Conf;
|
||||||
lto::ThinBackend Backend;
|
|
||||||
|
|
||||||
// LLD supports the new relocations.
|
// LLD supports the new relocations.
|
||||||
Conf.Options = InitTargetOptionsFromCodeGenFlags();
|
Conf.Options = InitTargetOptionsFromCodeGenFlags();
|
||||||
|
@ -68,6 +67,9 @@ static std::unique_ptr<lto::LTO> createLTO() {
|
||||||
checkError(Conf.addSaveTemps(std::string(Config->OutputFile) + ".",
|
checkError(Conf.addSaveTemps(std::string(Config->OutputFile) + ".",
|
||||||
/*UseInputModulePath*/ true));
|
/*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);
|
return llvm::make_unique<lto::LTO>(std::move(Conf), Backend, Config->LtoJobs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
}
|
|
@ -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
|
||||||
|
}
|
Loading…
Reference in New Issue