https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114991

            Bug ID: 114991
           Summary: [14/15 Regression] AArch64: LDP pass does not handle
                    some structure copies
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: wilco at gcc dot gnu.org
  Target Milestone: ---

The following example no longer emits LDP/STP since GCC14:

#include <string.h>

typedef struct { int arr[20]; } S;

void g (S *);
void h (S);
void f(int x)
{
  S s;
  g (&s);
  h (s);
}

f:
        stp     x29, x30, [sp, -176]!
        add     x1, sp, 96
        mov     x29, sp
        add     x0, sp, 16
        ldp     q29, q31, [x1]
        ldr     q30, [x1, 32]
        str     q29, [sp, 16]
        ldr     q29, [x1, 48]
        str     q31, [x0, 16]
        ldr     q31, [x1, 64]
        stp     q30, q29, [x0, 32]
        str     q31, [x0, 64]
        bl      h
        ldp     x29, x30, [sp], 176
        ret

The expansions for memcpy/move/memset no longer emit LDP directly in RTL and
now rely on the new LDP pass. Stack based loads/stores seem to confuse its
alias checks and it gives up.

Using -fno-schedule-insns fixes this example, but not all cases.

Reply via email to