<div dir="ltr">We should expose this flag separately from the parallel LTO parallelism level. See what we do in the gold plugin for example.<div><br></div><div>Peter</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 10, 2016 at 11:12 AM, Davide Italiano via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: davide<br>
Date: Mon Oct 10 13:12:53 2016<br>
New Revision: 283787<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=283787&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=283787&view=rev</a><br>
Log:<br>
[LTO/Thin] Make the number of threads to run in the BE configurable.<br>
<br>
Before the default was whatever number hardware_concurrency() returned.<br>
Users can specify the number of threads via --lto-jobs=X option.<br>
<br>
Added:<br>
lld/trunk/test/ELF/lto/Inputs/<wbr>thinlto.ll<br>
lld/trunk/test/ELF/lto/<wbr>thinlto.ll<br>
Modified:<br>
lld/trunk/ELF/LTO.cpp<br>
<br>
Modified: lld/trunk/ELF/LTO.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LTO.cpp?rev=283787&r1=283786&r2=283787&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/ELF/LTO.cpp?<wbr>rev=283787&r1=283786&r2=<wbr>283787&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/LTO.cpp (original)<br>
+++ lld/trunk/ELF/LTO.cpp Mon Oct 10 13:12:53 2016<br>
@@ -49,7 +49,6 @@ static void checkError(Error E) {<br>
<br>
static std::unique_ptr<lto::LTO> createLTO() {<br>
lto::Config Conf;<br>
- lto::ThinBackend Backend;<br>
<br>
// LLD supports the new relocations.<br>
Conf.Options = InitTargetOptionsFromCodeGenFl<wbr>ags();<br>
@@ -68,6 +67,9 @@ static std::unique_ptr<lto::LTO> createL<br>
checkError(Conf.addSaveTemps(<wbr>std::string(Config-><wbr>OutputFile) + ".",<br>
/*UseInputModulePath*/ true));<br>
<br>
+ lto::ThinBackend Backend;<br>
+ if (Config->LtoJobs)<br>
+ Backend = lto::<wbr>createInProcessThinBackend(<wbr>Config->LtoJobs);<br>
return llvm::make_unique<lto::LTO>(<wbr>std::move(Conf), Backend, Config->LtoJobs);<br>
}<br>
<br>
<br>
Added: lld/trunk/test/ELF/lto/Inputs/<wbr>thinlto.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto/Inputs/thinlto.ll?rev=283787&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/test/ELF/<wbr>lto/Inputs/thinlto.ll?rev=<wbr>283787&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/test/ELF/lto/Inputs/<wbr>thinlto.ll (added)<br>
+++ lld/trunk/test/ELF/lto/Inputs/<wbr>thinlto.ll Mon Oct 10 13:12:53 2016<br>
@@ -0,0 +1,7 @@<br>
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:<wbr>32:64-S128"<br>
+target triple = "x86_64-unknown-linux-gnu"<br>
+<br>
+define void @g() {<br>
+entry:<br>
+ ret void<br>
+}<br>
<br>
Added: lld/trunk/test/ELF/lto/<wbr>thinlto.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto/thinlto.ll?rev=283787&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/test/ELF/<wbr>lto/thinlto.ll?rev=283787&<wbr>view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/test/ELF/lto/<wbr>thinlto.ll (added)<br>
+++ lld/trunk/test/ELF/lto/<wbr>thinlto.ll Mon Oct 10 13:12:53 2016<br>
@@ -0,0 +1,29 @@<br>
+; Basic ThinLTO tests.<br>
+; RUN: llvm-as %s -o %t.o<br>
+; RUN: llvm-as %p/Inputs/thinlto.ll -o %t2.o<br>
+<br>
+; First force single-threaded mode<br>
+; RUN: ld.lld -save-temps --lto-jobs=1 -shared %t.o %t2.o -o %t<br>
+; RUN: llvm-nm %t.lto.o | FileCheck %s --check-prefix=NM<br>
+<br>
+; NM: T f<br>
+; NM: T g<br>
+<br>
+; Next force multi-threaded mode<br>
+; RUN: ld.lld -save-temps --lto-jobs=2 -shared %t.o %t2.o -o %t2<br>
+; RUN: llvm-nm %t20.lto.o | FileCheck %s --check-prefix=NM1<br>
+; RUN: llvm-nm %t21.lto.o | FileCheck %s --check-prefix=NM2<br>
+<br>
+; NM1: T g<br>
+; NM2: T f<br>
+<br>
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:<wbr>32:64-S128"<br>
+target triple = "x86_64-unknown-linux-gnu"<br>
+<br>
+declare void @g(...)<br>
+<br>
+define void @f() {<br>
+entry:<br>
+ call void (...) @g()<br>
+ ret void<br>
+}<br>
<br>
<br>
______________________________<wbr>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">-- <div>Peter</div></div></div>
</div>