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

Wilco <wilco at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wilco at gcc dot gnu.org

--- Comment #3 from Wilco <wilco at gcc dot gnu.org> ---
(In reply to Ramana Radhakrishnan from comment #1)
> Confirmed - still an issue with gcc trunk and same issue exists on aarch64 
> 
> ( -fomit-frame-pointer is a red herring).
> 
>         str     x30, [sp, -32]!
>         add     x1, sp, 32
>         strb    w0, [x1, -1]!
>         mov     x0, x1
>         bl      foo
>         ldr     x30, [sp], 32
>         ret

It's a bug in the auto_inc_dec phase. It shouldn't apply to constant addresses.
If I disable pre-decrement I get the expected:

        str     x30, [sp, -32]!
        strb    w0, [sp, 31]
        add     x0, sp, 31
        bl      foo3
        ldr     x30, [sp], 32
        ret

Generally pre/post increment should be used when adjusting a pointer in a loop
- besides that there are very few cases where it improves code.

Reply via email to