PCRE compiles fines and passes the test suite :)

Hi,

Just a quick note to tell you that PCRE 7.6 (latest version) compiles fine with clang and the compiled binary passes the test suite as well.

Hi,

Just a quick note to tell you that PCRE 7.6 (latest version) compiles fine
with clang and the compiled binary passes the test suite as well.

Great news!

---
compiler | compile+link time | test suite run time | binary size
gcc 4.1 | 17s | 1.9s | 43KB
clang+llvm | 1m 13s | 1.4s | 188KB
---

Although llvm is much slower at compiling (the linking part seems to be
really slow due to the -O2 optimizations), the binary produced is much
faster :slight_smile:

This doesn't makes sense to me. Are you using an optimized "release" version of clang?

If so, can you compile/measure with -fsyntax-only?

Congratulations to everybody :wink:

Ditto. Chris and I couldn't be happier with the way this community has pulled together.

snaroff

Hi,

Just a quick note to tell you that PCRE 7.6 (latest version)
compiles fine
with clang and the compiled binary passes the test suite as well.

Great news!

That is excellent!

---
compiler | compile+link time | test suite run time | binary size
gcc 4.1 | 17s | 1.9s | 43KB
clang+llvm | 1m 13s | 1.4s | 188KB
---

Although llvm is much slower at compiling (the linking part seems to
be
really slow due to the -O2 optimizations), the binary produced is much
faster :slight_smile:

This doesn't makes sense to me. Are you using an optimized "release"
version of clang?

If so, can you compile/measure with -fsyntax-only?

Also, does 'ccc' contribute substantially to this? How much time does it take to run if you hack 'ccc' to just run a noop command like "echo

llvm-as | ..." instead of running clang?

I expect that writing + parsing the bytecode emitted by clang, forking exec'ing processes, etc takes a lot of the time.

As Steve says, a debug build is also far slower than an optimized one (3-10x).

Congratulations to everybody :wink:

Ditto. Chris and I couldn't be happier with the way this community has
pulled together.

You guys are awesome!

-Chris

I believe all time is spent in "llvm-ld -O2", which does the
interprocedual optimization IIRC.

Makes sense. It would still be good to have numbers to verify...

Since GCC doesn't do IPO by default, it would be useful to have an "apples to apples" comparison.

I want to make sure clang stays competitive (in terms of compile time)...

snaroff

A 'more' apples to apple comparison would be to do:

clang -emit-llvm-bc | opt -std-compile-opts | llc > foo.s

at compile time, which roughly corresponds to -O3. It will be slower because of the forking/execing and writing/reading of bc files, but the codegen should be comparable.

-Chris

---
compiler | compile+link time | test suite run time | binary size
gcc 4.1 | 17s | 1.9s | 43KB
clang+llvm | 1m 13s | 1.4s | 188KB
---

Although llvm is much slower at compiling (the linking part seems to be
really slow due to the -O2 optimizations), the binary produced is much
faster :slight_smile:

This doesn't makes sense to me. Are you using an optimized "release" version of clang?

no, it was a debug build. With a release build of llvm, it takes only 10 seconds to build pcre! It's even faster than gcc 4.1 :slight_smile:
Of course this could still be better because of the overhead of the ccc script.

P.S.2.: why isn't LLVM deployed to replace gcc? isn't it capable to act as a
drop-in replacement for gcc with the gcc front-end (for now)?

Noone tackle this question.. My question is for real: can llvm already be used as a drop-in replacement of gcc or not? e.g. can I already rebuild my gentoo system (including the kernel) with llvm? :slight_smile:

Nuno

P.S.: the clang build is currently broken because of a commit to LLVM's ADT/StringMap.h.

---
compiler | compile+link time | test suite run time | binary size
gcc 4.1 | 17s | 1.9s | 43KB
clang+llvm | 1m 13s | 1.4s | 188KB
---

Although llvm is much slower at compiling (the linking part seems to be
really slow due to the -O2 optimizations), the binary produced is much
faster :slight_smile:

This doesn't makes sense to me. Are you using an optimized "release"
version of clang?

no, it was a debug build. With a release build of llvm, it takes only 10
seconds to build pcre! It's even faster than gcc 4.1 :slight_smile:
Of course this could still be better because of the overhead of the ccc
script.

Much better...:slight_smile: I'd be surprised if ccc is introducing much overhead. The best way to know is to measure. If you are running on Mac OS X, Shark is a wonderful performance analysis tool to tell us exactly where the overhead is.

P.S.2.: why isn't LLVM deployed to replace gcc? isn't it capable to act
as a
drop-in replacement for gcc with the gcc front-end (for now)?

Noone tackle this question.. My question is for real: can llvm already be
used as a drop-in replacement of gcc or not? e.g. can I already rebuild my
gentoo system (including the kernel) with llvm? :slight_smile:

Chris is in the best position to answer your question (which is why I didn't respond to it).

Nuno

P.S.: the clang build is currently broken because of a commit to LLVM's
ADT/StringMap.h.

Good catch! Hopefully this will be fixed soon...

snaroff

---
compiler | compile+link time | test suite run time | binary size
gcc 4.1 | 17s | 1.9s | 43KB
clang+llvm | 1m 13s | 1.4s | 188KB
---

Although llvm is much slower at compiling (the linking part seems to be
really slow due to the -O2 optimizations), the binary produced is much
faster :slight_smile:

This doesn't makes sense to me. Are you using an optimized "release"
version of clang?

no, it was a debug build. With a release build of llvm, it takes only 10
seconds to build pcre! It's even faster than gcc 4.1 :slight_smile:
Of course this could still be better because of the overhead of the ccc
script.

Much better...:slight_smile: I'd be surprised if ccc is introducing much overhead. The best way to know is to measure. If you are running on Mac OS X, Shark is a wonderful performance analysis tool to tell us exactly where the overhead is.

:slight_smile:
no, I don't have a mac (please don't ban me :P). I don't really know any similar tools on linux. (K)cachegrind is nice, but is slow as hell.

Nuno

Nuno Lopes wrote:

no, I don't have a mac (please don't ban me :P). I don't really know any
similar tools on linux. (K)cachegrind is nice, but is slow as hell.
  

On Linux Oprofile [*1] can be used for system-wide performance
profiling. It uses hardware performance counters, so overhead is minimal.
If you're concerned about latencies, you can try the latencytop [*2]
tool (but it requires a kernel patch to be applied).

[*1] OProfile examples
[*2] http://latencytop.org/

Best regards,
--Edwin

---
compiler | compile+link time | test suite run time | binary size
gcc 4.1 | 17s | 1.9s | 43KB
clang+llvm | 1m 13s | 1.4s | 188KB
---
Although llvm is much slower at compiling (the linking part seems to be
really slow due to the -O2 optimizations), the binary produced is much
faster :slight_smile:
This doesn't makes sense to me. Are you using an optimized "release"

version of clang?

no, it was a debug build. With a release build of llvm, it takes only 10
seconds to build pcre! It's even faster than gcc 4.1 :slight_smile:
Of course this could still be better because of the overhead of the ccc
script.

Nice, that's 1.7x faster, not bad. Particularly considering it's doing LTO etc.

P.S.2.: why isn't LLVM deployed to replace gcc? isn't it capable to act
as a
drop-in replacement for gcc with the gcc front-end (for now)?

Noone tackle this question.. My question is for real: can llvm already be
used as a drop-in replacement of gcc or not? e.g. can I already rebuild my
gentoo system (including the kernel) with llvm? :slight_smile:

If the question is "can llvm-gcc do absolutely everything that gcc can do", the answer is no. That said, the known problems are in mostly obscure areas. I would expect that you should be able to build a huge percentage of your gentoo system with llvm-gcc, but probably not 100%.

-Chris

P.S.2.: why isn't LLVM deployed to replace gcc? isn't it capable to act
as a
drop-in replacement for gcc with the gcc front-end (for now)?

Noone tackle this question.. My question is for real: can llvm already be
used as a drop-in replacement of gcc or not? e.g. can I already rebuild my
gentoo system (including the kernel) with llvm? :slight_smile:

If the question is "can llvm-gcc do absolutely everything that gcc can do", the answer is no. That said, the known problems are in mostly obscure areas. I would expect that you should be able to build a huge percentage of your gentoo system with llvm-gcc, but probably not 100%.

Nice! So it seems I can start lobbying the gentoo devs to include llvm in the package tree and allow it to be used as an alternative to gcc.

Thanks,
Nuno

Yep, please wait until after the llvm 2.2 release though :slight_smile:

-Chris

Hello, Nuno

Nice! So it seems I can start lobbying the gentoo devs to include llvm in
the package tree and allow it to be used as an alternative to gcc.

I think it will be better at least to include packages as-is at first:

http://bugs.gentoo.org/show_bug.cgi?id=186279

Ah, thanks for the pointer. It seems someone has already provided a llvm toolchain eclass.
I'll wait for llvm 2.2 and then I'll start hacking it, but in a VM for now.

Nuno