[Bug target/126450] [16/17 Regression] wrong code at -O2 -mavx2 since r16-8339

"cvs-commit at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126450

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-16 branch has been updated by H.J. Lu <[email protected]>:

https://gcc.gnu.org/g:ad1212765889961594a678912c21c55d1e447679

commit r16-9435-gad1212765889961594a678912c21c55d1e447679
Author: H.J. Lu <[email protected]>
Date:   Wed Jul 29 06:23:57 2026 +0800

    x86: Check argument-linked memory used for local variable

    Since in

    typedef int V [[gnu::vector_size (16)]];
    long long a, b, c, d, e;
    short f;
    [[gnu::vector_size (8 * sizeof (int))]] int g;
    V h;
    _Bool i;

    void
    foo (V x)
    {
      _Bool j = 0;
      short l = 0;
    l1:
      b = l;
      x = h;
      ...
    }

    the register argument, x, is used as local variable, also return true if
    spilling an SSA_NAME into an argument-linked memory.

    gcc/

            PR target/126450
            * config/i386/i386.cc (ix86_spill_register_argument_p): Check
            the argument-linked memory used to store local variable.

    gcc/testsuite/

            PR target/126450
            * gcc.target/i386/pr126450-1.c: New test.
            * gcc.target/i386/pr126450-2.c: Likewise.

    Signed-off-by: H.J. Lu <[email protected]>
    (cherry picked from commit ea27cb48a346633d6bfabcde75f88affb9463e40)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.