Yuxi Chen via llvm-dev
2016-Jul-23 00:20 UTC
[llvm-dev] difference between llvm-gcc and clang
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 ________________________________________ From: Tim Northover [t.p.northover at gmail.com] Sent: Thursday, July 21, 2016 4:11 PM To: Yuxi Chen Cc: llvmdev at cs.uiuc.edu; llvm-dev at lists.llvm.org; llvmdev-bounces at cs.uiuc.edu Subject: Re: [llvm-dev] difference between llvm-gcc and clang On 21 July 2016 at 14:02, Yuxi Chen via llvm-dev <llvm-dev at lists.llvm.org> wrote:> 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.
Tim Northover via llvm-dev
2016-Jul-23 01:02 UTC
[llvm-dev] difference between llvm-gcc and clang
On 22 July 2016 at 17:20, Yuxi Chen <chenyuxi at uchicago.edu> wrote:> 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.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.
Yuxi Chen via llvm-dev
2016-Jul-23 01:05 UTC
[llvm-dev] difference between llvm-gcc and clang
Get it. Really appreciate your help. Yuxi> On Jul 22, 2016, at 8:02 PM, Tim Northover <t.p.northover at gmail.com> wrote: > >> On 22 July 2016 at 17:20, Yuxi Chen <chenyuxi at uchicago.edu> wrote: >> 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. > > 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.