anonymous
2012-Feb-16  18:39 UTC
[LLVMdev] difference in function prologue generated with clang and gcc
Hello Anton, Thanks for the reply. I have not specified optimization level explicitly during compilation. For GCC default is O0 ie., no optimization. Do you mean that clang uses other optimization level other than O0 ? Could you please clarify ? On Thu, Feb 16, 2012 at 6:52 PM, Anton Korobeynikov <anton at korobeynikov.info> wrote:> Hello > > > The prologue length in .debug_line is 157 for clang generated one, > whereas > > it is 34 for gcc generated one. I am curious about the results of making > > prologue generated by clang look similar with one generated by gcc. > > Could anyone let me know why this difference exists and if it is for good > > /better purposes than for gcc. ? > 1. This is not function prologue length. It's the header (aka > 'prologue') length of .debug_line section > 2. The length of function prologue is 3 instructions in case of clang > (12 bytes) and 2 instruction (8 bytes) in case of gcc > 3. Comparison of code size of unoptimized code does not make any sense. > > Hope this makes the stuff clear. > > -- > With best regards, Anton Korobeynikov > Faculty of Mathematics and Mechanics, Saint Petersburg State University >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120217/ac6e3b63/attachment.html>
Anton Korobeynikov
2012-Feb-16  18:44 UTC
[LLVMdev] difference in function prologue generated with clang and gcc
> Thanks for the reply. I have not specified optimization level explicitly > during compilation. For GCC default is O0 ie., no optimization. Do you mean > that clang uses other optimization level other than O0 ?No, here it's still -O0. However it makes no sense to compare the size of unoptimized code. -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University
Arnt Gulbrandsen
2012-Feb-16  20:19 UTC
[LLVMdev] difference in function prologue generated with clang and gcc
If a reason is needed: It makes no sense, because it's not something the maintainers care about. Small size is not -O0 is about. You might as well compare how compressible the clang output is compared to g++. "zip compresses clang output better than gcc, but 7z compresses gcc output better than clang." Arnt
anonymous
2012-Feb-24  12:36 UTC
[LLVMdev] difference in function prologue generated with clang and gcc
Hello
I am trying to run following dejaGNU testcases on Clang compiled output.
/* Inlined inline function must have abstract DIE  */
/* { dg-do compile } */
/* { dg-options "-O2 -gdwarf-2 -dA -fpreprocessed" } */
/* { dg-final { scan-assembler "3.*DW_AT_inline" } } */
#1 "test.h"
inline int t()
{
}
int q()
{
  t();
}
The testcase fails because, DW_AT_inline is not present in assembly output.
Could anyone let me know why DW_AT_inline is not emitted ?
I am aware that Clang uses C99 mode by default.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20120224/209abd96/attachment.html>
Seemingly Similar Threads
- [LLVMdev] DW_AT_inline not present in assembly for an inlined inline function
- [LLVMdev] difference in function prologue generated with clang and gcc
- [LLVMdev] difference in function prologue generated with clang and gcc
- Batch computer account creation
- Courier->dovecot migration script