<div dir="ltr">Hi,<div><br></div><div>I'm having the same issue. You can speed up the JIT by disabling the code gen optimizations.</div><div>when creating the execution engine:</div><div>.setOptLevel(llvm::CodeGenOpt::None) </div><div>and  try to enable Fast instruction selection</div><div>.setTargetOptions</div><div><br></div><div>But with the above applied my profiler (release mode ofcourse) is still showing a lot of time spent in JIT (86%) code gen.</div><div>It's also weird that when I look at the individual functions in the profile, malloc and free are taking up 80% of the total time.</div><div>40% of it is done with a smallvectorimpl resize in the passmanager. </div><div><br></div><div>The modules generally contains around 3 small functions. It should be fast. </div><div>For my project fast JIT time is more important than the actual runtime since the statements are "simple". I do run a passmanager on functions to optimize the IR. <br></div><div><br></div><div>So what is generally the best approach when you require fast code generation time ? Specifically, how to minimize time spent in going from IR to native Code. </div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 9, 2016 at 4:52 PM, David Jones via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@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"><div dir="ltr"><div><div><div><div><div><div><div>I am trying to improve my application's compile-time performance.<br><br></div>On a given workload, I take 68 seconds to compile some code. If I disable the LLVM code generation (i.e. I will generate IR instructions, but skip the LLVM optimization and instruction selection steps) then my compile time drops to 3 seconds.  If I write out the LLVM IR (just to prove that I am generating it) then my compile time is 4 seconds. We're spending >90% of the time in LLVM code generation.<br><br></div>To try to determine if there's anything I can do, I ran:<br><br> time /tools/llvm/3.7.1dbg/bin/opt -O1 -filetype=obj -o opt.o my_ir.ll -time-passes<br><br></div>and I get:<br><br>===-------------------------------------------------------------------------===<br>                      ... Pass execution timing report ...<br>===-------------------------------------------------------------------------===<br>  Total Execution Time: 19.1382 seconds (19.1587 wall clock)<br><br>   ---User Time---   --System Time--   --User+System--   ---Wall Time---  --- Name ---<br>   4.4755 ( 23.5%)   0.0000 (  0.0%)   4.4755 ( 23.4%)   4.4806 ( 23.4%)  Dead Store Elimination<br>   3.6255 ( 19.0%)   0.0000 (  0.0%)   3.6255 ( 18.9%)   3.6282 ( 18.9%)  Combine redundant instructions<br>   1.2138 (  6.4%)   0.0040 (  5.0%)   1.2178 (  6.4%)   1.2185 (  6.4%)  SROA<br>...<br>real    1m7.783s<br>user    1m7.548s<br>sys     0m0.183s<br><br></div>So: opt reports that it took 19 seconds, but overall, the run took 88 seconds. The system in question is a 6-core AMD K10 with 8GB of memory. The system is not running anything else at the time.<br><br></div>What activity accounts for the unaccounted-for time?<br><br></div>For my application, IR verification has pathological performance (I ought to file a bug on that), therefore I disable it. It is not clear if the IR verifier is running in my opt runs. There is no line item for it.<br><br></div>It is also not clear if opt does instruction selection. I tried specifying -filetype=null but that makes no difference to the run time.<br><br></div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div></div>