LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   GCC vs LLVM (https://www.linuxquestions.org/questions/slackware-14/gcc-vs-llvm-931034/)

ozanbaba 03-20-2012 12:56 AM

Quote:

Originally Posted by Martinus2u (Post 4615249)
I grew up with Pure C (formerly Turbo C) on m68k hardware which compiled 20 times faster than GCC and produced similarly well optimized code (since then optimization has improved no doubt). I believe the speed difference between CLANG and GCC is similar. That alone makes it worth it.

I did not noticed much speed difference when compiling things like Wine etc. It sure compiles Carbon fast but then there's real world.
Check out a nice detailed benchmark here.

a4z 03-20-2012 01:14 PM

that's why llvm is also good for gcc

http://gcc.gnu.org/ml/gcc/2012-03/msg00256.html

http://gcc.gnu.org/ml/gcc/2012-03/msg00263.html

mlpa 05-14-2012 05:16 AM

Free BSD 10 To Use Clang Compiler, Deprecate GCC, link.
Maybe there is some important advantage of LLVM on top of GCC.

TobiSGD 05-14-2012 05:49 AM

Quote:

Originally Posted by mlpa (Post 4677871)
Free BSD 10 To Use Clang Compiler, Deprecate GCC, link.
Maybe there is some important advantage of LLVM on top of GCC.

Yes, there is. LLVM/Clang is licensed with a BSD license and the BSD people want to become GNU-free.

mlpa 05-14-2012 09:04 AM

From what I read in the Phoronix forum the bitcode compiled by clang is 5-15% slower than the same code compiled with GCC without optimizations.

Clang is not a mature yet.

leeeoooooo 05-18-2012 09:50 PM

I'm delighted that LLVM was included with the new X updates in current. I've been watching this project for several years wondering if it would ever come into more general acceptance.

"GCC vs LLVM"??? I don't get it. To me they are very different tools. Yes, LLVM has a compiler--so does Perl.

To me, the compiler in LLVM has more in common with the Perl compiler than with GCC.

The LLVM compiler targets the Low Level Virtual Machine, just as the Perl compiler targets the Perl runtime. The only differences I see are that the LLVM compiler compiles C and the Perl compiler compiles Perl, and the LLVM operates more closely to the hardware than the Perl runtime does.

GCC directly targets a variety of hardware. LLVM targets a VM layer that can make compiled code more portable.

Apples and Oranges in my book.

rg3 05-19-2012 02:48 AM

Sorry, but that's far from being accurate at all. GCC has front-ends to different languages, and backends to multiple architectures. When the frontends run, they translate the code to an intermediate language or virtual machine, if you prefer, like RTL. GCC and LLVM, in that sense, work very similarly. Of course, internally they're very different, but just not in that concept.

http://en.wikipedia.org/wiki/Interme...uage#Languages
http://en.wikipedia.org/wiki/Register_Transfer_Language

Martinus2u 05-19-2012 02:56 AM

also, for historic reasons and for different optimization steps gcc employes a variety of internal representations of the code. of course, this doesn't help performance very much.

leeeoooooo 05-19-2012 05:35 AM

Quote:

Originally Posted by rg3 (Post 4682435)
Sorry, but that's far from being accurate at all. GCC has front-ends to different languages, and backends to multiple architectures. When the frontends run, they translate the code to an intermediate language or virtual machine, if you prefer, like RTL. GCC and LLVM, in that sense, work very similarly. Of course, internally they're very different, but just not in that concept.

http://en.wikipedia.org/wiki/Interme...uage#Languages
http://en.wikipedia.org/wiki/Register_Transfer_Language

Yes but...

How GCC works internally isn't the point. The output is raw machine code. LLVM's compiler outputs bytecode to run on top of the LLVM, rather like the .Net languages which can't run without .Net

LLVM just has a much lower level of abstraction and so, can run much faster.

GazL 05-19-2012 06:01 AM

Quote:

Originally Posted by leeeoooooo (Post 4682521)
Yes but...

How GCC works internally isn't the point. The output is raw machine code. LLVM's compiler outputs bytecode to run on top of the LLVM, rather like the .Net languages which can't run without .Net

Code:

gazl@darkstar:/tmp$ cat >clang-test.c     
#include <stdio.h>
int main( int argc, char ** argv )
{
  printf("I'll be damned!\n");
  return 0;
}

gazl@darkstar:/tmp$ clang -o doesitwork clang-test.c
gazl@darkstar:/tmp$ ./doesitwork
I'll be damned!
gazl@darkstar:/tmp$ su -l root -c "removepkg llvm >/dev/null 2>&1 && echo llvm removed."
Password:
llvm removed.
gazl@darkstar:/tmp$ ./doesitwork
I'll be damned!
gazl@darkstar:/tmp$



All times are GMT -5. The time now is 04:58 AM.