Announcement

Collapse
No announcement yet.

LLVM 2.6 Released, Clang Is Now Production Ready

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #11
    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).

    Comment


    • #12
      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; 25 October 2009, 06:46 PM.

      Comment


      • #13
        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.

        Comment


        • #14
          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; 25 October 2009, 07:14 PM.

          Comment


          • #15
            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

            Comment


            • #16
              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.

              Comment


              • #17
                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.

                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.


                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.

                Comment


                • #18
                  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:
                  The MDN Web Docs site provides information about Open Web technologies including HTML, CSS, and APIs for both Web sites and progressive web apps.

                  Comment


                  • #19
                    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:
                    RESOLVED (taras.mozilla) in Firefox Build System - General. Last updated 2018-11-26.

                    Comment


                    • #20
                      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; 26 October 2009, 12:30 PM.

                      Comment

                      Working...
                      X