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

            Bug ID: 100697
           Summary: Missing fwprop for argument register
           Product: gcc
           Version: 10.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhongyunde at huawei dot com
  Target Milestone: ---

cat test.c

extern double top[100];

int foo (long long j, double a) {
  top[j] += a;
  return 0;
}

gcc10.3 -g0 -O3 -march=armv8.2-a test.c -save-temps -S, can also be test base
on https://gcc.godbolt.org.

        .type   foo, %function
foo:
.LFB0:
        .cfi_startproc
        mov     x2, x0   -- redundant could be fwprop
        adrp    x1, top
        add     x1, x1, :lo12:top
        mov     w0, 0
        ldr     d1, [x1, x2, lsl 3]
        fadd    d0, d1, d0
        str     d0, [x1, x2, lsl 3]
        ret

If x0 fwprop into both ldr and str, then the insn mov   x2, x0 can be deleted.

Reply via email to