No announcement yet.

Google Now Uses Clang As Their Production Compiler For Chrome Linux Builds

  • Filter
  • Time
  • Show
Clear All
new posts

  • #31
    Originally posted by curaga View Post
    Gcc 5 should be getting the identical code detection. Does anyone know if clang supports it?
    LLVM has a mergefunc optimization pass. It's not currently enabled by default in Clang (due to lack of research into the compile-time vs. size reduction trade-off), but it's possible to flip it on.


    • #32
      And when did they switch to clang ? because chrome for linux is broken since version 35 or 36 ......


      • #33
        Originally posted by birdie View Post
        Bullocks. What matters to the user is performance and performance only (stability too, but GCC rarely miscompiles the code and such errors are usually fixed in a timely manner).

        Google has thousands of servers so the compiler performance is like the last thing on Earth they care about.

        I smell something fishy here - like they withhold some important information about the decision but let's leave it to them.
        Oh for crying out loud.
        Before you run off on some crazy conspiracy theory, you know that Chandler Carruth, the Clang lead dev, is a Google employee, right?

        For all you know, their primary motivation in making this change is so that they can use LLVM as a fourth tier JIT, like Safari does...


        • #34
          clang has come a long way from an interesting research project to a production quality compiler.

          Fast compilation, especially in (-O0 -g) or (-O2 -g) setting, is pretty important for developers. And better diagnostics (not always more diag, but more relevant ones), is huge help for development. Admittedly, what's better diagnostics is a pretty subjective thing and GCC has been playing catch up pretty hard fro the past two releases.

          From a user perspective, performance and stability are what matters. I strongly disagree that clang is worse than GCC (4.9) in these two areas.

          If you look recent phoronix benchmark, you will see that the performance of clang and GCC are mixed, there is no clean winner. The only clean win of GCC is OpenMP enabled benchmarks. But, OpenMP is not the only parallel programming model on earth. And it is not the best way to go either, not in all applications. In some situation it is the easiest way to get parallelization, but not always. Intel TBB, etc., provides good, and some time better alternatives. OpenMP is very fast (compared to other programming models) when parallelizing small loops, but it is neither better or worse than others when parallelization of big loops or other kinds of parallel patterns, in my experience.

          In short, over-all, feature-wise, GCC does not have an advantage (nor a disadvantage) when compared to clang.

          For other kinds optimization, those that almost all modern compilers do, clang is very competitive. It will depends on the kind of programs you do. For me, I find that clang can often produce faster binary than both GCC and Intel ICC (ICPC). Intel's compiler has long being believed to be the gold standard of performance, but in the past two years, I no longer see it true. Both Clang and GCC has catch up with it and the only area I see a clean win for Intel is when libm functions are the bottleneck of performance (Intel parallelize loop to SVML calls and others replaced by libimf call, while Linux' GLibc is unacceptably slow for scientific use in these scenarios)

          In addition, one reason that GCC is sometime faster is not because GCC is better at optimization, but because for a long time it is only good production compiler in open source world and people have tailored their code for it. I often see code like the following in open source software,

          #if __GNUC__ >= 4 && __GNUC_MINOR__ >= 6 // or whatever minor version
          // do something special, such as use some built-in or use some optimization hints
          // do something generic or nothing

          However, clang's compatibility with GCC is getting better and better, and if in your project, there is no or little such constructs (or you can include clang in the directive check) often you find that GCC is no better than clang. And now google is using clang, for all we know, they can tailor their code for clang

          In short, there is no reason to believe that clang will produce slower binaries, not in any user noticeable way, than GCC.

          Stability wise, compiler bugs do exists and there are a lot of them out there. But any sane person will agree, for every time your program crash because of the compiler, there are at least ten or hundred times it crash because of the code of the project rather than the compiler. At least, I rarely find compiler bugs are the main source of instability.

          In summary clang does not really has a disadvantage against GCC when it comes to binary performance or stability. (However, I don't think there is much advantage, either).

          Since binary performance and stability are not the issue, why not choose a compiler that make developer's life easier? And in this case, that is Google's developer's life and which is better is a subjective thing for them rather than for us.


          • #35
            Regarding compiler bugs, I find it funny that people believe gcc has an edge there. It might be with code that does undefined/unspecified stuff and expects this to work in the "gcc way", but that aint exactly clangs fault.

            Personally I had quite a few code-generation bugs with gcc 4.7 and 4.8, and the way I fixed them was to search the issues with clang since the diagnostic is alot better and catches standard violations that gcc didnt check and silently turned into binary nonsense. The primary source of this was the C++11 constexpr keyword (and lack of experience with it on my side).


            • #36
              It shouldn't surprise anyone GCC has been dumped en masse with the rise of clang/LLVM.

              A completely modern compiler suite with a free and open license BSD style instead of the cancerous viral GPL that has stiffed development for years. As soon as clang/LLVM was usable there was an explosion in creativity and development in the compiler world.

              That is what happens when your ideology is simply to write well engineered code that will be useful for the world and not some nutty and poisonous ideology like GNU.


              "If GCC is modular, it makes it much easier to write plugins that are not, in law, derivative works. And again, for Free Software folks, that is highly undesirable."