[llvm-bugs] [Bug 49271] New: clang 12.0 incorrectly passes AVX SIMD arguments to function

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Feb 19 11:58:49 PST 2021


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

            Bug ID: 49271
           Summary: clang 12.0 incorrectly passes AVX SIMD arguments to
                    function
           Product: clang
           Version: unspecified
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: npcarter at g.harvard.edu
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

Created attachment 24555
  --> https://bugs.llvm.org/attachment.cgi?id=24555&action=edit
Source code for test case

We're observing cases where code compiled with Clang 12.0 on an x86 Mac does
not correctly pass AVX SIMD register parameters to functions.  The attached
file contains a function "calc_band_1", which was derived from a key function
in the HMMER homology search program.  When compiled using on an x86 Mac, using
the command "clang -g -O0 -lm -mavx -march=native bug_test2.c -o bug_test2",
garbage values are passed to the two __m256 arguments to calc_band_1.  

This was observed under:
clang --version
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin20.3.0
Thread model: posix

Other versions of clang or other C compilers have not shown this behavior, and
changing the optimization parameter to "-03" causes the code to compile and run
correctly.

This bug seems tied to the overall complexity of the function being called, and
in particular to the number of AVX vector variables declared in it.  We had to
include most of the original calc_band_1 function in the test case to recreate
the bug, and even with most of the function replicated, the bug only appears if
calc_band_1 declares a large number of __m256 variables.  On our machines, the
function as provided passes the wrong values in the SIMD arguments to
calc_band_1, but, if you delete one of the __m256 variable declarations at the
start of the function and re-compile, the _m256 arguments are passed correctly.

-- 
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/20210219/fbaa84fb/attachment.html>


More information about the llvm-bugs mailing list