[LLVMbugs] [Bug 23240] New: Less efficient stack adjustment code with -g

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Apr 15 07:32:47 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=23240

            Bug ID: 23240
           Summary: Less efficient stack adjustment code with -g
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: russell_gallop at sn.scee.net
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Enabling debug info results in larger code at address 0x13. Without -g a 1 byte
pop instruction is used, with -g a 4 byte add is used to adjust the stack
pointer. Guessing that this is in the X86 backend.

Reduced from Burg in the llvm-test-suite. With revision r234984.

$ cat lex.c
int a;
int fn2();
int fn1() {
  int b;
  if ((b = fn2()) == '\n')
    a++;
  return b;
}
$ clang -c -O1 lex.c -o lex.o && objdump -d lex.o

lex.o:     file format elf64-x86-64

Disassembly of section .text:

0000000000000000 <fn1>:
   0:   50                      push   %rax
   1:   31 c0                   xor    %eax,%eax
   3:   e8 00 00 00 00          callq  8 <fn1+0x8>
   8:   83 f8 0a                cmp    $0xa,%eax
   b:   75 06                   jne    13 <fn1+0x13>
   d:   ff 05 00 00 00 00       incl   0x0(%rip)        # 13 <fn1+0x13>
  13:   5a                      pop    %rdx
  14:   c3                      retq
$ clang -c -O1 lex.c -o lex_g.o -g && objdump -d lex_g.o

lex_g.o:     file format elf64-x86-64

Disassembly of section .text:

0000000000000000 <fn1>:
   0:   50                      push   %rax
   1:   31 c0                   xor    %eax,%eax
   3:   e8 00 00 00 00          callq  8 <fn1+0x8>
   8:   83 f8 0a                cmp    $0xa,%eax
   b:   75 06                   jne    13 <fn1+0x13>
   d:   ff 05 00 00 00 00       incl   0x0(%rip)        # 13 <fn1+0x13>
  13:   48 83 c4 08             add    $0x8,%rsp
  17:   c3                      retq

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150415/d028e5d3/attachment.html>


More information about the llvm-bugs mailing list