[llvm-bugs] [Bug 49372] New: clang v10 optimizations causing Valgrind false-positives

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Feb 27 10:33:52 PST 2021


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

            Bug ID: 49372
           Summary: clang v10 optimizations causing Valgrind
                    false-positives
           Product: new-bugs
           Version: 10.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: eyalsoha at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

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:
https://bugs.kde.org/show_bug.cgi?id=432801#c12

-- 
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/20210227/8ae25a7c/attachment.html>


More information about the llvm-bugs mailing list