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

            Bug ID: 22947
           Summary: Less efficient encoding using direct object emission
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: MC
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

For the following source the code generated by direct object emission is less
efficient than outputting to .s. Using r232386.

$ cat decrement.c
int foo(int a) {
    return --a;
}
$ clang -c decrement.c -o decrement.o
$ clang -S decrement.c -o decrement.s && clang -c decrement.s -o
decrement_via_s.o
$ objdump -d decrement.o

decrement.o:     file format elf64-x86-64


Disassembly of section .text:

0000000000000000 <foo>:
   0:   55                      push   %rbp
   1:   48 89 e5                mov    %rsp,%rbp
   4:   89 7d fc                mov    %edi,-0x4(%rbp)
   7:   8b 7d fc                mov    -0x4(%rbp),%edi
   a:   81 c7 ff ff ff ff       add    $0xffffffff,%edi
  10:   89 7d fc                mov    %edi,-0x4(%rbp)
  13:   89 f8                   mov    %edi,%eax
  15:   5d                      pop    %rbp
  16:   c3                      retq
$ objdump -d decrement_via_s.o

decrement_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:   89 7d fc                mov    %edi,-0x4(%rbp)
   7:   8b 7d fc                mov    -0x4(%rbp),%edi
   a:   83 c7 ff                add    $0xffffffff,%edi
   d:   89 7d fc                mov    %edi,-0x4(%rbp)
  10:   89 f8                   mov    %edi,%eax
  12:   5d                      pop    %rbp
  13:   c3                      retq

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to