Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 26

Thread: LLVM 2.6 Released, Clang Is Now Production Ready

  1. #11
    Join Date
    Nov 2007
    Posts
    1,024

    Default

    Quote Originally Posted by Game_boy View Post
    If such large performance improvements over GCC are possible, why has GCC itself not been changed? It's not short of developers, money or expertise.
    First, the GCC codebase is disgustingly hard to work with. It's a giant pile of hacky C code, where as LLVM and Clang are (relatively) cleanly written C++ with intentional effort put into making it easy to hack on.

    Second, RMS and the FSF are tools tbat only just recently stopped trying to actively make GCC near impossible to reuse. Clang was designed to be very easily used for third-party tools, like static analyzers or IDE integration, which RMS did not want to make possible with GCC out of an insane fear that proprietary developers would abuse any kind of parser API in a non-Free project. It took years of developers and users complaining and the looming threat of LLVM+Clang to get him to change his tune.

    Third, LLVM has for a long time now had capable interprocedural analysis and optimization, while GCC has only just started to get support for such things via a rather hacky and kludgy approach. IPO allows for greater optimization of a program or library, and has been supported in various commercial compilers for some time.

    Finally, LLVM has that "VM" part to it, while GCC is just a compiler. This opens up a lot of possibilities for Clang, including interpreting C/C++ code, which opens up a lot of possibilities for future compiler experimentation (say, a REAL meta-programming facility in C++, instead of the shitacular abuse of templates that people pass off as meta-programming today).

    GCC already died once (when it was replaced with the fork EGCS), and there's no reason to fear letting it die again. ALL projects die eventually. Linux itself will die someday. Maybe not anytime soon, but it'll happen. Heck, Windows already died twice, too. Clang could replace GCC, and it can only be an improvement (because if it isn't, it won't ever replace GCC in the first place).

  2. #12
    Join Date
    Jan 2009
    Posts
    88

    Default

    I think I get what you're saying, but llvm has its own type system that for the most part is independent of machine code. Not sure about endianness. I don't think it was ever meant for compiling win32/linux binaries that run under different OS's. That would require runtime libraries to be coherent under both and a proper interface. I think the problem goes away if llvm has pragmas or something for that. The programmer would have to know enough about what he's doing to guarantee that the code is JITable..
    Last edited by garytr24; 10-25-2009 at 06:46 PM.

  3. #13
    Join Date
    Oct 2008
    Posts
    3,074

    Default

    Quote Originally Posted by Micket View Post
    Ex-Cyber, i thought he meant more like "actually put it to good use"? Although, i dont know how efficient the profiled optimizations are in GCC.
    I don't know how good they are, but they're definitely used. If you bootstrap the gcc compilation, you can see it generating and using the profile when building itself. So I'm guessing it has at least some benefits, or they wouldn't bother enabling it for the compiler.

    Maybe he meant LLVM doesn't have a profiler based optimizations? From what i could find, it does have a framework setup for them, but not a lot of optimizations based off of it.

  4. #14
    Join Date
    Aug 2006
    Posts
    158

    Default

    Quote Originally Posted by Ex-Cyber View Post
    What do the -fprofile-generate and -fprofile-use options do, then?
    There are two kinds of GCC optimizations:
    1. those enabled by -O2
    2. those that backfire, crash GCC, generate bad code, or are otherwise not reliable

    The flags you mentioned are of the latter sort, as the Mozilla devs have discovered with Firefox. Gentoo ricer learn this the hard way too.

    Thus I think its fair to disregard GCC's alleged support for profiling. At least until Firefox can have Profile Guided Optimization on Linux.
    Last edited by StringCheesian; 10-25-2009 at 07:14 PM.

  5. #15
    Join Date
    Oct 2009
    Posts
    845

    Default

    Quote Originally Posted by garytr24 View Post
    one thing GCC can't do at all that modern compilers do according to my compilers prof is profiling and optiimizations that make use of it. And GCC is huge and a pain to work with. It's been around for a really long time. LLVM brings a whole new clean infrastructure for compiler development. C and Objective-C are pretty done, and C++ is WIP.
    You should change professor, Gcc has had profile-guided-optimization from atleast v 3.4

  6. #16
    Join Date
    Oct 2009
    Posts
    845

    Default

    Quote Originally Posted by StringCheesian View Post
    There are two kinds of GCC optimizations:
    1. those enabled by -O2
    2. those that backfire, crash GCC, generate bad code, or are otherwise not reliable

    The flags you mentioned are of the latter sort, as the Mozilla devs have discovered with Firefox. Gentoo ricer learn this the hard way too.

    Thus I think its fair to disregard GCC's alleged support for profiling. At least until Firefox can have Profile Guided Optimization on Linux.
    there seems to be alot of people talking about things they have no clue about. GCC profile generated optimizations works great with firefox and has for a long time. also -O3 has been very stable for ages, or can you submit some code that won't compile correctly with -O3? I build stuff with profile guided optimizations every day and have had no problems, and I've had speed improvements as high as ~10-13% so it's a very strong optimization. With the data the profile stage collects it makes much better choices with branch prediction and caches.

  7. #17
    Join Date
    Oct 2009
    Posts
    845

    Default

    Quote Originally Posted by elanthis View Post
    First, the GCC codebase is disgustingly hard to work with. It's a giant pile of hacky C code, where as LLVM and Clang are (relatively) cleanly written C++ with intentional effort put into making it easy to hack on.
    LLVM is alot cleaner that's for sure, given that it was started 13 years later and written using an object oriented language (c++). However, gcc is not the same gcc that was released in 1987, it's internals have been greatly enhanced since then.

    Quote Originally Posted by elanthis View Post
    Second, RMS and the FSF are tools tbat only just recently stopped trying to actively make GCC near impossible to reuse. Clang was designed to be very easily used for third-party tools, like static analyzers or IDE integration, which RMS did not want to make possible with GCC out of an insane fear that proprietary developers would abuse any kind of parser API in a non-Free project. It took years of developers and users complaining and the looming threat of LLVM+Clang to get him to change his tune.
    RMS has had nothing to do with GCC for ages, it's all done by the gcc steering committee, consisting of people from redhat, ibm, suse etc. You are spewing nonsense.


    Quote Originally Posted by elanthis View Post
    Third, LLVM has for a long time now had capable interprocedural analysis and optimization, while GCC has only just started to get support for such things via a rather hacky and kludgy approach. IPO allows for greater optimization of a program or library, and has been supported in various commercial compilers for some time.
    LLVM's LTO (link-time-optimization) only works for OSX afaik, although you should be able to get it to work on linux using the gold linker plugin but this seems to be a big hit or miss deal. GCC 4.5 branch has LTO now.

    LLVM has made great strides during the last year and is edging in on GCC. On many of the language shootout tests I've tried using -march=native -O3 -mfpmath=sse it beats gcc (although by a small margin), however on most large programs it loses by alot ~10%. Also it lacks profile-guided-optimization which really does make a big difference. I'm eager to get started on benchmarking llvm 2.6 given that there seems to be alot of improvements and comparing it to gcc 4.4 and 4.5 snapshots.

  8. #18
    Join Date
    Jan 2009
    Posts
    88

    Default

    Quote Originally Posted by XorEaxEax View Post
    there seems to be alot of people talking about things they have no clue about. GCC profile generated optimizations works great with firefox and has for a long time. also -O3 has been very stable for ages, or can you submit some code that won't compile correctly with -O3? I build stuff with profile guided optimizations every day and have had no problems, and I've had speed improvements as high as ~10-13% so it's a very strong optimization. With the data the profile stage collects it makes much better choices with branch prediction and caches.
    ya,
    "The Mozilla build system contains support for building with Profile-Guided Optimization (PGO) with GCC 4 or newer and Microsoft Visual C++ 2005 (Professional Edition) or newer."

    from:
    https://developer.mozilla.org/en/Bui...d_Optimization

  9. #19
    Join Date
    Aug 2006
    Posts
    158

    Default

    Quote Originally Posted by garytr24 View Post
    ya,
    "The Mozilla build system contains support for building with Profile-Guided Optimization (PGO) with GCC 4 or newer and Microsoft Visual C++ 2005 (Professional Edition) or newer."

    from:
    https://developer.mozilla.org/en/Bui...d_Optimization
    If there's nothing wrong with GCC's PGO support, then why is GCC being blamed here:
    https://bugzilla.mozilla.org/show_bug.cgi?id=418866

  10. #20
    Join Date
    Aug 2006
    Posts
    158

    Default

    Quote Originally Posted by XorEaxEax View Post
    also -O3 has been very stable for ages, or can you submit some code that won't compile correctly with -O3?
    I've had a very different experience. After switching from my first distro (Mandrake) to Gentoo I went wild on CFLAGS to see what would happen and had problems. I found by trial and error that there was a risk of instability with anything more than -O2.

    I still see Gentoo forum threads where the problem turns out to be CFLAGS in excess of "-O2 -march=something". It seems to me that nothing has changed and GCC's optimizer is still buggy outside of -O2.

    So I don't see how more advanced optimizations could be working fine for you unless you're not applying it to as broad a variety of source code as Gentoo users do.
    Last edited by StringCheesian; 10-26-2009 at 12:30 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •