<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Less efficient stack adjustment code with -g"
   href="https://llvm.org/bugs/show_bug.cgi?id=23240">23240</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Less efficient stack adjustment code with -g
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Backend: X86
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>russell_gallop@sn.scee.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>