<html>
    <head>
      <base href="http://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 --- - Different encoding using direct object emission"
   href="http://llvm.org/bugs/show_bug.cgi?id=22854">22854</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Different encoding using direct object emission
          </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>MC
          </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>For the following source the generated code is different between direct object
emission and .s. Using r231635.

The code using direct object emissions seems to be less efficient.

$ cat test.c
void foo (void) {
    for (int s = 0; s != 1 ; s++)
        ;
}
$ clang -c test.c -o test.o
$ clang -S test.c -o test.s && clang -c test.s -o test_via_s.o
$ objdump -d test.o

test.o:     file format elf64-x86-64


Disassembly of section .text:

0000000000000000 <foo>:
   0:   55                      push   %rbp
   1:   48 89 e5                mov    %rsp,%rbp
   4:   c7 45 fc 00 00 00 00    movl   $0x0,-0x4(%rbp)
   b:   81 7d fc 01 00 00 00    cmpl   $0x1,-0x4(%rbp)
  12:   0f 84 15 00 00 00       je     2d <foo+0x2d>
  18:   e9 00 00 00 00          jmpq   1d <foo+0x1d>
  1d:   8b 45 fc                mov    -0x4(%rbp),%eax
  20:   05 01 00 00 00          add    $0x1,%eax
  25:   89 45 fc                mov    %eax,-0x4(%rbp)
  28:   e9 de ff ff ff          jmpq   b <foo+0xb>
  2d:   5d                      pop    %rbp
  2e:   c3                      retq
$  objdump -d test_via_s.o

test_via_s.o:     file format elf64-x86-64


Disassembly of section .text:

0000000000000000 <foo>:
   0:   55                      push   %rbp
   1:   48 89 e5                mov    %rsp,%rbp
   4:   c7 45 fc 00 00 00 00    movl   $0x0,-0x4(%rbp)
   b:   83 7d fc 01             cmpl   $0x1,-0x4(%rbp)
   f:   74 0d                   je     1e <foo+0x1e>
  11:   eb 00                   jmp    13 <foo+0x13>
  13:   8b 45 fc                mov    -0x4(%rbp),%eax
  16:   83 c0 01                add    $0x1,%eax
  19:   89 45 fc                mov    %eax,-0x4(%rbp)
  1c:   eb ed                   jmp    b <foo+0xb>
  1e:   5d                      pop    %rbp
  1f:   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>