<html>
    <head>
      <base href="https://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 --- - Missed induction variable optimizations (-m64 -O2 -march=slm)"
   href="https://llvm.org/bugs/show_bug.cgi?id=27519">27519</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Missed induction variable optimizations (-m64 -O2 -march=slm)
          </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>Windows NT
          </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>Loop Optimizer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>andrew.senkevich@intel.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=16267" name="attach_16267" title="Small reproducer">attachment 16267</a> <a href="attachment.cgi?id=16267&action=edit" title="Small reproducer">[details]</a></span>
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.</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>