[LLVMdev] LLVM compile speed significantly slower than GCC (w/ test case)

dag at cray.com dag at cray.com
Fri Jul 20 14:22:51 PDT 2012


Renato Golin <rengolin at systemcall.org> writes:

> If you compile to IR then pass "opt -time-passes" you can get a good
> idea who the culprit is:
>
> $ clang -O0 -S -emit-llvm sha1test.c
> $ opt -time-passes -O2 sha1test.s
> (...)
>    ---User Time---   --System Time--   --User+System--   ---Wall
> Time---  --- Name ---
>    0.2720 ( 54.0%)   0.0000 (  0.0%)   0.2720 ( 53.5%)   0.2821 (
> 52.8%)  Combine redundant instructions
>    0.1160 ( 23.0%)   0.0000 (  0.0%)   0.1160 ( 22.8%)   0.1162 (
> 21.8%)  Combine redundant instructions
>    0.0600 ( 11.9%)   0.0000 (  0.0%)   0.0600 ( 11.8%)   0.0610 (
> 11.4%)  Combine redundant instructions
>    0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0205 (
> 3.8%)  Early CSE
>    0.0240 (  4.8%)   0.0000 (  0.0%)   0.0240 (  4.7%)   0.0204 (
> 3.8%)  Combine redundant instructions
>    0.0200 (  4.0%)   0.0000 (  0.0%)   0.0200 (  3.9%)   0.0203 (
> 3.8%)  Combine redundant instructions
> (...)
>
> That's roughly 99% user / 97% wall clock.
>
> Seeing from your source, you have a few simple macros repeated over
> and over, which will stress the combiner, for sure.
>
> This is a great micro-benchmark (and a very common pattern), thanks
> for the report!

Incidentally, we just ran into a compile time issue that also pointed to
instcombine.  Just another datapoint to confirm that some work here
would be helpful.

                              -Dave



More information about the llvm-dev mailing list