<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 - clang v10 optimizations causing Valgrind false-positives"
   href="https://bugs.llvm.org/show_bug.cgi?id=49372">49372</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang v10 optimizations causing Valgrind false-positives
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>10.0
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

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

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

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Starting in clang version 10 (not in version 9), one of the loop optimizations
is generating code that is correct but can lead to a false-positive error
report in Valgrind.

I think that clang could generate code that would perform just as well as the
code that it's already creating but it would be more Valgrind-friendly and
allow Valgrind's memchecker to handle it better.

This code:

  401697:       66 0f 6e d2             movd   %edx,%xmm2
  40169b:       66 0f 60 d2             punpcklbw %xmm2,%xmm2
  40169f:       66 0f 61 da             punpcklwd %xmm2,%xmm3

which was generated to use two different xmm registers could just as well be
this:

  4016a3:       66 0f 6e da             movd   %edx,%xmm3
  4016a7:       66 0f 60 db             punpcklbw %xmm3,%xmm3
  4016ab:       66 0f 61 db             punpcklwd %xmm3,%xmm3

Which only uses one xmm register.  Doing that fixes the spurious error report
from Valgrind and I think that it would have no negative impact on performance.

More information and a test case are available on the Valgrind bug report:
<a href="https://bugs.kde.org/show_bug.cgi?id=432801#c12">https://bugs.kde.org/show_bug.cgi?id=432801#c12</a></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>