<div dir="ltr">Hello Tim,<div><br></div><div>Thanks for the tips !<br><br><div class="gmail_quote"><div dir="ltr">On Thu, Feb 23, 2017 at 11:15 PM Tim Northover <<a href="mailto:t.p.northover@gmail.com">t.p.northover@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Sanjay,<br class="gmail_msg">
<br class="gmail_msg">
On 23 February 2017 at 09:21, SANJAY SRIVALLABH SINGAPURAM via<br class="gmail_msg">
llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="gmail_msg" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br class="gmail_msg">
> My system hangs every time during last stages of building LLVM ( starting at<br class="gmail_msg">
> 95% in a CMake build ) using CMake or Ninja, sometime close to the linking<br class="gmail_msg">
> of llvm-dysmutil. Could you please suggest tips that could speed up the<br class="gmail_msg">
> compilation ?<br class="gmail_msg">
<br class="gmail_msg">
This is probably because multiple linker processes are using all your<br class="gmail_msg">
memory and bogging down in swap. There are various things you can do<br class="gmail_msg">
to improve performance:<br class="gmail_msg">
<br class="gmail_msg">
  * There's an LLVM_PARALLEL_LINK_JOBS option which you can use to<br class="gmail_msg">
reduce the number of ld instances running at once (you'll need to be<br class="gmail_msg">
using Ninja rather than Make for this to work, but that's faster<br class="gmail_msg">
anyway). This is a slightly more fine-grained approach than Tobias's<br class="gmail_msg">
"-j 1"; systems can usually support more compile jobs than link.<br class="gmail_msg">
 * If on Linux, you can switch to ld.gold (or lld if you're feeling<br class="gmail_msg">
brave!), which is much faster than the default ld.bfd<br class="gmail_msg"></blockquote><div>Would complications arise because of a <i>cyclic dependency</i>, using lld to build (a newer) lld, and possibly changing the lld binary while it's being used to link other files ?</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
 * Also on ELF platforms, there's LLVM_USE_SPLIT_DWARF which separates<br class="gmail_msg">
the debug info into a different file. This really speeds things up,<br class="gmail_msg">
but you need a recent(ish) gdb to be able to debug the result.<br class="gmail_msg">
<br class="gmail_msg">
Those are the obvious ways to reduce memory. You might also consider<br class="gmail_msg">
only building the targets you need, which will speed things up but not<br class="gmail_msg">
get around swapping usually.<br class="gmail_msg"></blockquote><div>This is my experience after targeting only X86 and NVPTX !! 😆</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br class="gmail_msg">
Cheers.<br class="gmail_msg">
<br class="gmail_msg">
Tim.<br class="gmail_msg"></blockquote><div>Thank You,</div><div>Sanjay Srivallabh </div></div></div></div>