[llvm-dev] Where is opt spending its time?

Justin Lebar via llvm-dev llvm-dev at lists.llvm.org
Wed Mar 9 13:39:51 PST 2016


> What activity accounts for the unaccounted-for time?

If you're on Linux, consider using a proper CPU profiler, such as
perf(1).  It's really easy to use -- on x86-64, compiling
RelWithDebInfo with -fno-omit-frame-pointer has given me excellent
results.

Good luck.

On Wed, Mar 9, 2016 at 7:52 AM, David Jones via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> I am trying to improve my application's compile-time performance.
>
> 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.
>
> To try to determine if there's anything I can do, I ran:
>
>  time /tools/llvm/3.7.1dbg/bin/opt -O1 -filetype=obj -o opt.o my_ir.ll
> -time-passes
>
> and I get:
>
> ===-------------------------------------------------------------------------===
>                       ... Pass execution timing report ...
> ===-------------------------------------------------------------------------===
>   Total Execution Time: 19.1382 seconds (19.1587 wall clock)
>
>    ---User Time---   --System Time--   --User+System--   ---Wall Time---
> --- Name ---
>    4.4755 ( 23.5%)   0.0000 (  0.0%)   4.4755 ( 23.4%)   4.4806 ( 23.4%)
> Dead Store Elimination
>    3.6255 ( 19.0%)   0.0000 (  0.0%)   3.6255 ( 18.9%)   3.6282 ( 18.9%)
> Combine redundant instructions
>    1.2138 (  6.4%)   0.0040 (  5.0%)   1.2178 (  6.4%)   1.2185 (  6.4%)
> SROA
> ...
> real    1m7.783s
> user    1m7.548s
> sys     0m0.183s
>
> 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.
>
> What activity accounts for the unaccounted-for time?
>
> 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.
>
> It is also not clear if opt does instruction selection. I tried specifying
> -filetype=null but that makes no difference to the run time.
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>


More information about the llvm-dev mailing list