[llvm-bugs] [Bug 34565] New: X86CmovConversion ineffective when debug info is enabled

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Sep 11 17:58:27 PDT 2017


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

            Bug ID: 34565
           Summary: X86CmovConversion ineffective when debug info is
                    enabled
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: matthew.voss at sony.com
                CC: llvm-bugs at lists.llvm.org

rL308142 added a new optimization that converts cmov instructions to
combinations of
branch and mov instructions when the branch is well predicted 

Some of our internal testing highlighted a case where this optimization is
ineffective
when debug info is generated.  That is, when debug info is enabled, the cmov
instruction
is still generated.

A reduced IR repro is attached, both with and without debug info. Also, I've
included the
C++ file that was used to generate both of them.

Reproduce using:
    $ clang -O2 -c g.ll ; objdump -d --no-show-raw-insn g.o > g.dis
    $ clang -O2 -c no_g.ll ; objdump -d --no-show-raw-insn no_g.o > no_g.dis
    $ sdiff -w74 g.dis no_g.dis

    g.o:     file format elf64-x86-64   |   no_g.o:     file format elf64-x86-


    Disassembly of section .text.main:      Disassembly of section .text.main:

    0000000000000000 <main>:                0000000000000000 <main>:
       0:   push   %rbp                        0:   push   %rbp
       1:   mov    %rsp,%rbp                   1:   mov    %rsp,%rbp
       4:   push   %r15                        4:   push   %r15
       6:   push   %r14                        6:   push   %r14
       8:   push   %r12                        8:   push   %r12
       a:   push   %rbx                        a:   push   %rbx
       b:   mov    $0xa,%r14d           |      b:   mov    $0xa,%r15d
      11:   xor    %ebx,%ebx            |     11:   xor    %r12d,%r12d
      13:   lea    0x0(%rip),%r15       |     14:   lea    0x0(%rip),%r14
      1a:   nopw   0x0(%rax,%rax,1)     |     1b:   nopl   0x0(%rax,%rax,1)
      20:   lea    (%r14,%rbx,1),%r12d  |     20:   lea    (%r15,%r12,1),%ebx
      24:   callq  29 <main+0x29>             24:   callq  29 <main+0x29>
      29:   cltq                              29:   cltq
>>>   2b:   cmp    %rax,(%r15,%r12,8)   |     2b:   cmp    %rax,(%r14,%rbx,8)
>>>   2f:   cmovae %r12d,%r14d          |     2f:   jb     40 <main+0x40>
>>>   33:   cmovb  %r12d,%ebx           |     31:   mov    %ebx,%r15d
      37:   cmp    %r14d,%ebx           |     34:   cmp    %r15d,%r12d
      3a:   jb     20 <main+0x20>       |     37:   jb     20 <main+0x20>
      3c:   xor    %eax,%eax            |     39:   jmp    48 <main+0x48>
      3e:   pop    %rbx                 |     3b:   nopl   0x0(%rax,%rax,1)
      3f:   pop    %r12                 |     40:   mov    %ebx,%r12d
      41:   pop    %r14                 |     43:   cmp    %r15d,%r12d
      43:   pop    %r15                 |     46:   jb     20 <main+0x20>
      45:   pop    %rbp                 |     48:   xor    %eax,%eax
      46:   retq                        |     4a:   pop    %rbx
                                        >     4b:   pop    %r12
                                        >     4d:   pop    %r14
                                        >     4f:   pop    %r15
                                        >     51:   pop    %rbp
                                        >     52:   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/20170912/5bf3905e/attachment-0001.html>


More information about the llvm-bugs mailing list