<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - compiler crash when optimizing multiple _mm_hsub_epi16 intrinsics in certain pattern"
   href="https://bugs.llvm.org/show_bug.cgi?id=51974">51974</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>compiler crash when optimizing multiple _mm_hsub_epi16 intrinsics in certain pattern
          </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>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Backend: X86
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>benjsith@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>craig.topper@gmail.com, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, pengfei.wang@intel.com, spatel+llvm@rotateright.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=25294" name="attach_25294" title="Compiler output with error log/callstack">attachment 25294</a> <a href="attachment.cgi?id=25294&action=edit" title="Compiler output with error log/callstack">[details]</a></span>
Compiler output with error log/callstack

I ran into a compiler crash when compiling some SSE code. It appears to stem
from optimizing a specific dataflow for some intrinsics, which causes the DAG
to have cycles. A debug build asserts, while a release build infinitely loops.

The following is a minimal repro example:

#include <immintrin.h>
__m128i do_stuff(__m128i A) {
        __m128i B = _mm_hadd_epi16(A, A);
        __m128i C = _mm_hadd_epi16(B, A);
        return C;
}

when compiled with `clang -O1 -msse4` it exhibits the issue. It also appears to
repro if both intrinsics are changed to one of _mm_hadd_epi32, _mm_hsub_epi16,
or _mm_hsub_epi32. It does not repro with -O0.

I've attached the error output I get from the compiler showing more details
including the state of the DAG and a callstack

I tested this on trunk at commit 9820dd970c1b72c7f77fad647b762053e2f60e31 and
confirmed it's still present. It happens both on Windows and Linux.</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>