[llvm-bugs] [Bug 51974] New: compiler crash when optimizing multiple _mm_hsub_epi16 intrinsics in certain pattern

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Sep 26 06:07:42 PDT 2021


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

            Bug ID: 51974
           Summary: compiler crash when optimizing multiple _mm_hsub_epi16
                    intrinsics in certain pattern
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: benjsith at gmail.com
                CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
                    llvm-dev at redking.me.uk, pengfei.wang at intel.com,
                    spatel+llvm at rotateright.com

Created attachment 25294
  --> https://bugs.llvm.org/attachment.cgi?id=25294&action=edit
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.

-- 
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/20210926/e82d2898/attachment.html>


More information about the llvm-bugs mailing list