Page 1 of 2 12 LastLast
Results 1 to 10 of 26

Thread: LLVM 2.6 Released, Clang Is Now Production Ready

Hybrid View

  1. #1
    Join Date
    Jan 2007
    Posts
    15,413

    Default LLVM 2.6 Released, Clang Is Now Production Ready

    Phoronix: LLVM 2.6 Released, Clang Is Now Production Ready

    Version 2.6 of LLVM, the Low-Level Virtual Machine, has been released. This modular compiler infrastructure, which can replace many parts of the GNU Compiler Collection and go far beyond the conventional roles as a code compiler such as being used within Apple's Mac OS X OpenGL implementation for providing optimizations and is similarly going to be used within Gallium3D, has taken a major leap forward with the 2.6 release. LLVM 2.6 includes better x86_64 code generation, new code generators for multiple architectures, support for SSE 4.2, improved optimizations, and perhaps most notably it is the first release to include Clang where it's now at a "production quality" status for C and Objective-C on x86...

    http://www.phoronix.com/vr.php?view=NzYzNw

  2. #2
    Join Date
    Jan 2009
    Posts
    80

    Default

    To what extent can LLVM be used on Linux? For example, can it compile the kernel? Can it be used alongside GCC? What are the benefits of using LLVM?

  3. #3
    Join Date
    Jan 2009
    Posts
    88

    Default

    my compilers class is making a lua compiler frontend for llvm :-). It's definitely good to start over once in a while, as gcc is old and crusty. I think llvm is a couple years away from being capable of being a replacement for gcc within linux, but it enables so much more already. There's the JIT, optimizations. Actually, apple switched to it as the compiler for iphone.

    Freebsd is trying to switch to it too, and gentoo folks as well. It compiles the freebsd kernel.

    To sum it up, llvm is Low-Level-Virtual-Machine, not GCC take2. The fact that it is capable of compiling into native code is necessary for its mission and nice, but it is much more than gcc. And supposedly it provides a very clean and modern C++ API for devs to mess with.
    Last edited by garytr24; 10-25-2009 at 01:54 PM. Reason: added some stuff

  4. #4
    Join Date
    Oct 2007
    Posts
    25

    Default

    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.

  5. #5
    Join Date
    Sep 2008
    Posts
    123

    Default

    Last time i checked, the higher optimizationlevels are yet to be implemented (i.e. no profiled optimizations), but maybe this has changed?

    GCC is a behemoth, not easily changed. GCC can create very good code, but sometimes that requires you to know the magic set of flags. From simple benchmarks i've seen GCC fail miserably, even though everthing the code was supposed to be doing was dead simple.


    I like the other features (other than faster compile time, and hopefully faster programs) even more, but I'm not sure what languages can take full advantage of it (things like cross platform llvm bitcode with run-time optimization, yummy!). It sure wont work with C/C++, thanks to #define (and probably other reasons too)

  6. #6
    Join Date
    Jan 2009
    Posts
    88

    Default

    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.

  7. #7
    Join Date
    Jan 2009
    Posts
    88

    Default

    Quote Originally Posted by Micket View Post
    Last time i checked, the higher optimizationlevels are yet to be implemented (i.e. no profiled optimizations), but maybe this has changed?

    GCC is a behemoth, not easily changed. GCC can create very good code, but sometimes that requires you to know the magic set of flags. From simple benchmarks i've seen GCC fail miserably, even though everthing the code was supposed to be doing was dead simple.


    I like the other features (other than faster compile time, and hopefully faster programs) even more, but I'm not sure what languages can take full advantage of it (things like cross platform llvm bitcode with run-time optimization, yummy!). It sure wont work with C/C++, thanks to #define (and probably other reasons too)
    why would #defines break it? do you mean like #define WIN32 or LINUX? I think the value would be for say the flash plugin to run on multiple architectures. A usb thumbdrive that can boot a linux OS on your ARM smartbook and netbook or whatever. Apple's using it right now for OpenCl and graphics shaders. If your video card can't support the shaders, the JIT compiles them to the cpu.

  8. #8
    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).

  9. #9
    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.

  10. #10

    Default

    Quote Originally Posted by elanthis View Post
    ALL projects die eventually. Linux itself will die someday. Maybe not anytime soon, but it'll happen.
    In what contest? I don't see any Linux fork out there. Are you a prophet or something? :P

    Heck, Windows already died twice, too.
    When?

    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).
    Clang can't even compile Linux kernel, GCC supports far more architectures, it's solid, mature and it's noticeably faster in some things, so right now, it doesn't seem GCC will die before Clang.

    Btw. GCC devs can always take LLVM code :> If it will be hard to adapt, why not to do llvm flag which will instruct GCC to use LLVM (to use it in situations where it makes faster code) instead: gcc -llvm [...] GCC will have all benefits then ;P just joking...
    Last edited by kraftman; 10-28-2009 at 06:02 AM.

Posting Permissions

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