[llvm-bugs] [Bug 27519] New: Missed induction variable optimizations (-m64 -O2 -march=slm)

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Apr 25 13:31:35 PDT 2016


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

            Bug ID: 27519
           Summary: Missed induction variable optimizations (-m64 -O2
                    -march=slm)
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: andrew.senkevich at intel.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 16267
  --> https://llvm.org/bugs/attachment.cgi?id=16267&action=edit
Small reproducer

Hi,

for attached test Clang generates 5% slower code than GCC due to missed
optimizations of induction variable.

Clang assembly for hottest loop:

  4005c0:    8b 1f                    mov    (%rdi),%ebx
  4005c2:    0f af 1e                 imul   (%rsi),%ebx
  4005c5:    83 c2 01                 add    $0x1,%edx
  4005c8:    48 81 c7 24 03 00 00     add    $0x324,%rdi
  4005cf:    48 83 c6 04              add    $0x4,%rsi
  4005d3:    01 d9                    add    %ebx,%ecx
  4005d5:    39 d0                    cmp    %edx,%eax
  4005d7:    75 e7                    jne    4005c0 <main+0x50>

GCC assembly:

  400410:    8b 94 87 60 10 60 00     mov    0x601060(%rdi,%rax,4),%edx
  400417:    48 83 c0 01              add    $0x1,%rax
  40041b:    48 81 c1 24 03 00 00     add    $0x324,%rcx
  400422:    0f af 91 dc fc ff ff     imul   -0x324(%rcx),%edx
  400429:    01 d6                    add    %edx,%esi
  40042b:    41 39 c0                 cmp    %eax,%r8d
  40042e:    7f e0                    jg     400410 <main+0x40>

And the same for outer loop.

-- 
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/20160425/fd0a5902/attachment.html>


More information about the llvm-bugs mailing list