<div dir="ltr">On Linux and on SSD.</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 29, 2016 at 4:38 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">On Windows, I imagine? On an SSD I assume?<br><br>Don't imagine there's much reason to believe it'd be substantially different on Linux.<br><br>Thanks for comparing!</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 29, 2016 at 4:35 PM, Rui Ueyama <span dir="ltr"><<a href="mailto:ruiu@google.com" target="_blank">ruiu@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Touched a single cc file and and rerun ninja check-clang with and without -O0. The two cases were in the same ballpark.</div><div><br></div><div>With -O0</div><div><br></div><div>Testing Time: 71.21s</div><div> Expected Passes : 9253</div><div> Expected Failures : 16</div><div> Unsupported Tests : 18</div><div><br></div><div>real 2m8.528s</div><div>user 30m7.967s</div><div>sys 5m54.938s</div></div><div><br></div><div>Without -O0</div><div><br></div><div>Testing Time: 72.62s</div><div> Expected Passes : 9253</div><div> Expected Failures : 16</div><div> Unsupported Tests : 18</div><div><br></div><div>real 2m9.602s</div><div>user 29m53.452s</div><div>sys 5m51.387s</div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 29, 2016 at 3:51 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Anyone want to test how fast this is to touch a single cc file, relink, rerun all the clang+llvm tests using this option (preferrably on an SSD)?<br><br>Be interesting to know if the increased code size slows down the test execution enough to wash out the benefit of the improved link time (as is the case with a shared library build - but of course there the overhead (loading the shared libraries) is greater)</div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 29, 2016 at 9:12 AM, Rui Ueyama 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: ruiu<br>
Date: Fri Apr 29 11:12:29 2016<br>
New Revision: 268056<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=268056&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=268056&view=rev</a><br>
Log:<br>
ELF: Add -O0 (produce output as fast as possible) mode.<br>
<br>
This patch redefines the default optimization level as 1 and adds<br>
new level 0. In the command line, it is -O0. The flag disables<br>
costly but optional features so that the linker produces semantically<br>
correct but larger output quickly. Currently it only disables<br>
section merging.<br>
<br>
This flag is not intended to be used for final production linking.<br>
It is intended to be used in compile-link-test cycle.<br>
<br>
Time to link clang with debug info is about 2x faster with the flag.<br>
<br>
Head:<br>
13.24 seconds<br>
Output size: 1227189664 bytes<br>
<br>
With this patch:<br>
7.41 seconds<br>
Output size: 2490281784 bytes<br>
<br>
Differential Revision: <a href="http://reviews.llvm.org/D19705" rel="noreferrer" target="_blank">http://reviews.llvm.org/D19705</a><br>
<br>
Modified:<br>
lld/trunk/ELF/Driver.cpp<br>
lld/trunk/ELF/InputFiles.cpp<br>
lld/trunk/test/ELF/merge-string.s<br>
<br>
Modified: lld/trunk/ELF/Driver.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=268056&r1=268055&r2=268056&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=268056&r1=268055&r2=268056&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/ELF/Driver.cpp (original)<br>
+++ lld/trunk/ELF/Driver.cpp Fri Apr 29 11:12:29 2016<br>
@@ -356,7 +356,7 @@ void LinkerDriver::readConfigs(opt::Inpu<br>
Config->SoName = getString(Args, OPT_soname);<br>
Config->Sysroot = getString(Args, OPT_sysroot);<br>
<br>
- Config->Optimize = getInteger(Args, OPT_O, 0);<br>
+ Config->Optimize = getInteger(Args, OPT_O, 1);<br>
Config->LtoO = getInteger(Args, OPT_lto_O, 2);<br>
if (Config->LtoO > 3)<br>
error("invalid optimization level for LTO: " + getString(Args, OPT_lto_O));<br>
<br>
Modified: lld/trunk/ELF/InputFiles.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=268056&r1=268055&r2=268056&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=268056&r1=268055&r2=268056&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/ELF/InputFiles.cpp (original)<br>
+++ lld/trunk/ELF/InputFiles.cpp Fri Apr 29 11:12:29 2016<br>
@@ -143,6 +143,12 @@ elf::ObjectFile<ELFT>::getShtGroupEntrie<br>
<br>
template <class ELFT> static bool shouldMerge(const typename ELFT::Shdr &Sec) {<br>
typedef typename ELFT::uint uintX_t;<br>
+<br>
+ // We don't merge sections if -O0 (default is -O1). This makes sometimes<br>
+ // the linker significantly faster, although the output will be bigger.<br>
+ if (Config->Optimize == 0)<br>
+ return false;<br>
+<br>
uintX_t Flags = Sec.sh_flags;<br>
if (!(Flags & SHF_MERGE))<br>
return false;<br>
<br>
Modified: lld/trunk/test/ELF/merge-string.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/merge-string.s?rev=268056&r1=268055&r2=268056&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/merge-string.s?rev=268056&r1=268055&r2=268056&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/test/ELF/merge-string.s (original)<br>
+++ lld/trunk/test/ELF/merge-string.s Fri Apr 29 11:12:29 2016<br>
@@ -4,6 +4,8 @@<br>
// RUN: llvm-readobj -s -section-data -t %t.so | FileCheck %s<br>
// RUN: ld.lld -O1 %t.o -o %t.so -shared<br>
// RUN: llvm-readobj -s -section-data -t %t.so | FileCheck --check-prefix=NOTAIL %s<br>
+// RUN: ld.lld -O0 %t.o -o %t.so -shared<br>
+// RUN: llvm-readobj -s -section-data -t %t.so | FileCheck --check-prefix=NOMERGE %s<br>
<br>
.section .rodata.str1.1,"aMS",@progbits,1<br>
.asciz "abc"<br>
@@ -55,6 +57,24 @@ zed:<br>
// NOTAIL-NEXT: 0000: 61626300 626300 |abc.bc.|<br>
// NOTAIL-NEXT: )<br>
<br>
+// NOMERGE: Name: .rodata<br>
+// NOMERGE-NEXT: Type: SHT_PROGBITS<br>
+// NOMERGE-NEXT: Flags [<br>
+// NOMERGE-NEXT: SHF_ALLOC<br>
+// NOMERGE-NEXT: SHF_MERGE<br>
+// NOMERGE-NEXT: SHF_STRINGS<br>
+// NOMERGE-NEXT: ]<br>
+// NOMERGE-NEXT: Address: 0x1C8<br>
+// NOMERGE-NEXT: Offset: 0x1C8<br>
+// NOMERGE-NEXT: Size: 16<br>
+// NOMERGE-NEXT: Link: 0<br>
+// NOMERGE-NEXT: Info: 0<br>
+// NOMERGE-NEXT: AddressAlignment: 2<br>
+// NOMERGE-NEXT: EntrySize: 0<br>
+// NOMERGE-NEXT: SectionData (<br>
+// NOMERGE-NEXT: 0000: 61626300 61626300 62630000 14000000 |abc.abc.bc......|<br>
+// NOMERGE-NEXT: )<br>
+<br>
// CHECK: Name: .rodata<br>
// CHECK-NEXT: Type: SHT_PROGBITS<br>
// CHECK-NEXT: Flags [<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">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/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>