difference between llvm-gcc and clang

Hi everyone,

Both llvm-gcc and clang would use llvm as its backend. Dose everyone know the difference of bitcode generated by llvm-gcc and llvm? Or actually they are same, like if I use the same compiler options, like -O4.

Any help is appreciated.

Best,
Yuxi

Both llvm-gcc and clang would use llvm as its backend. Dose everyone know
the difference of bitcode generated by llvm-gcc and llvm?

llvm-gcc used to be a compiler that used the GCC front-end (C parser
etc) to generate LLVM IR and then used the LLVM backends. It's a
long-abandoned project now though (not updated past GCC 4.2), with all
effort going into Clang (or GCC proper!).

You're only even likely to find traces of it on macOS, where
/usr/bin/llvm-gcc exists for backwards-compatibility reasons. However,
that's not really llvm-gcc any more, it's just another way to run
Clang.

Or actually they are same, like if I use the same compiler options, like -O4.

You shouldn't be using -O4. At one point I think it was a weird way to
trigger LTO (now you'd use -flto), but it's now only accepted for
compatibility and means the same thing as -O3. It gives you a warning
if you try to use it.

Cheers.

Tim.

llvm-gcc is obsolete, It was only an intermediate step to where we are today.

Hi Tim,

Thanks for your reply.
I know O4 is same as O3 now. I am wondering the bitcodes generated by llvm-gcc and clang are same, or almost same, I mean they are almost same, but maybe some newly-created optimization would exert impact.

Best,
Yuxi

Thanks for your reply.

Yuxi

If you can find an old version of llvm-gcc it will produce radically
different bitcode from Clang. So different that a modern LLVM wouldn't
even understand it.

But if you just run the pretend llvm-gcc that's on modern macOS
machines, it will produce code identical to Clang because it's
basically just a symlink *to* Clang.

Cheers.

Tim.

Get it.
Really appreciate your help.

Yuxi