[LLVMbugs] [Bug 8186] New: -O3 does not imply -fomit-frame-pointer

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Sep 19 05:55:15 PDT 2010


http://llvm.org/bugs/show_bug.cgi?id=8186

           Summary: -O3 does not imply -fomit-frame-pointer
           Product: clang
           Version: 2.7
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: helmut at subdivi.de
                CC: llvmbugs at cs.uiuc.edu


I compiled the following source using clang-2.7 -O3 on Debian sid amd64:

=====
struct buffer {
    const char *data;
    unsigned int length;
};

void buffer_inplace_advance(struct buffer *b, unsigned int length) {
        b->data += length;
        b->length -= length;
}
=====

This is a disassembly:
=====
Dump of assembler code for function buffer_inplace_advance:
   0x0000000000400760 <+0>:     push   %rbp
   0x0000000000400761 <+1>:     mov    %rsp,%rbp
   0x0000000000400764 <+4>:     mov    %esi,%eax
   0x0000000000400766 <+6>:     add    %rax,(%rdi)
   0x0000000000400769 <+9>:     sub    %eax,0x8(%rdi)
   0x000000000040076c <+12>:    pop    %rbp
   0x000000000040076d <+13>:    retq
=====

As you can see it contains a frame pointer. Turning on -fomit-frame-pointer in
addition to -O3 makes the code much shorter. For gcc -fomit-frame-pointer is
implied in -O3 on this architecture, so clang should probably do this, too.

According to baldrick (irc). This bug is reproducible on 2.8, too.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list