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

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So for aarch64, this is fully fixed.

For x86_64, it was improved in GCC 15 to produce:
```
f(int*, int*):
        cmp     rdi, rsi
        je      .L10
        push    rbx
        mov     rbx, rdi
        sub     rsp, 16
.L4:
        mov     edi, DWORD PTR [rbx]
        test    edi, edi
        jne     .L14
.L3:
        add     rbx, 4
        cmp     rsi, rbx
        jne     .L4
        add     rsp, 16
        pop     rbx
        ret
.L14:
        mov     QWORD PTR [rsp+8], rsi
        call    g(int)
        mov     rsi, QWORD PTR [rsp+8]
        mov     DWORD PTR [rbx], eax
        jmp     .L3
.L10:
        ret
```

Notice only save/restoring of rsi around the call but rbx is still pushed on
the stack. Looks like the rest of the bb from L3 is not copied into L14 unlike
what is done aarch64.

I don't know why though.

Reply via email to