[LLVMbugs] [Bug 22854] New: Different encoding using direct object emission

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Mar 9 08:54:14 PDT 2015


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

            Bug ID: 22854
           Summary: Different encoding using direct object emission
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: MC
          Assignee: unassignedbugs at nondot.org
          Reporter: russell_gallop at sn.scee.net
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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

-- 
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/20150309/c6cdb614/attachment.html>


More information about the llvm-bugs mailing list