<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 --- - [AVX2] possible intrinsics code generation regression"
   href="https://llvm.org/bugs/show_bug.cgi?id=31241">31241</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[AVX2] possible intrinsics code generation regression
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </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>LLVM Codegen
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>nicolasweber@gmx.de
          </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>(I'm filing this on behalf of <a href="mailto:jzern@google.com">jzern@google.com</a> -- <a href="mailto:llvm-admin@lists.llvm.org">llvm-admin@lists.llvm.org</a>
seems to not respond to bugzilla account creation requests at the moment.)

Last tested with llvm 2fbac67, clang d0cab34.

The origin of this comes from a bug report in webrtc [1] related to
libvpx. This project uses chrome's clang toolchain with revisions from
[2], with the behavior change occuring between the r284979 and r287226
builds.
I bisected with the mono repo [3], but I've confirmed the behavior
with the split ones as well.

I don't have a minimal repro and haven't been through this particular
code in much depth, so it's possible there's an issue with that, but this has
been enabled and working within chrome and elsewhere using clang and gcc for
some time.

The original bug had issues with 64-bit TSan/UBsan linux builds as well as
32-bit non-santized builds. I only looked at the 32-bit target during
this.

objdumps of the offending function (vpx_filter_block1d16_v8_avx2) and
the full file are attached.

To reproduce with libvpx:

$ git clone <a href="https://chromium-review.googlesource.com/webm/libvpx">https://chromium-review.googlesource.com/webm/libvpx</a>
$ mkdir libvpx-build
$ cd libvpx-build
$ CLANG=/tmp/clang/bin; CC=$CLANG//clang CXX=$CLANG/clang++ \
  ../libvpx/configure --target=x86-linux-gcc \
  --disable-vp8 --disable-libyuv --disable-examples --disable-docs
--enable-debug
$ make -j
# requires curl
$ make testdata
$ ./test_libvpx --gtest_filter=VP9/TestVectorTest.*

The above will pass if the commit in [3] is reverted.

[1] <a href="https://bugs.chromium.org/p/webrtc/issues/detail?id=6781#c9">https://bugs.chromium.org/p/webrtc/issues/detail?id=6781#c9</a>
[2]
<a href="http://commondatastorage.googleapis.com/chromium-browser-clang/index.html?path=Linux_x64/">http://commondatastorage.googleapis.com/chromium-browser-clang/index.html?path=Linux_x64/</a>
[3]
<a href="https://github.com/llvm-project/llvm-project/">https://github.com/llvm-project/llvm-project/</a>
$ git bisect start fd4590c^ 8bf715e
$ git cherry-pick -n fd4590c
$ cmake ../llvm \
  -DLLVM_ENABLE_PROJECTS="clang" \
  -DCMAKE_INSTALL_PREFIX=/tmp/clang -DCMAKE_BUILD_TYPE=Release
commit a69e8b1dcab2f3ae764b1ceea9a4bcc02bf406a4
Author: Craig Topper <<a href="mailto:craig.topper@gmail.com">craig.topper@gmail.com</a>>
Date:   Sun Oct 30 06:56:16 2016 +0000

    [X86] Use intrinsics table for PMADDUBSW and PMADDWD so that we
can use the legacy intrinsics to select EVEX encoded instructions when
available.

    This removes a couple tablegen classes that become unused after
this change. Another class gained an additional parameter to allow
PMADDUBSW to specify a different result type from its input type.

---
commit 648888d1c23187d01000ea4ae5811e6a0d880fcd
Author: Craig Topper <<a href="mailto:craig.topper@gmail.com">craig.topper@gmail.com</a>>
Date:   Sun Oct 30 06:56:16 2016 +0000

    [X86] Use intrinsics table for PMADDUBSW and PMADDWD so that we
can use the legacy intrinsics to select EVEX encoded instructions when
available.

    This removes a couple tablegen classes that become unused after
this change. Another class gained an additional parameter to allow
PMADDUBSW to specify a different result type from its input type.

    git-svn-id: <a href="https://llvm.org/svn/llvm-project/llvm/trunk@285515">https://llvm.org/svn/llvm-project/llvm/trunk@285515</a>
91177308-0d34-0410-b5e6-96231b3b80d8</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>