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

--- Comment #11 from Segher Boessenkool <segher at gcc dot gnu.org> ---
(In reply to Wilco from comment #8)
>       push    {r4, lr}
>       mov     r4, r0
>       cmp     r4, #0

Why does it copy r0 to r4 and then compare r4?  On more modern machines it
is faster to compare r0 itself, and it would allow shrink-wrapping to work
fine here (well, need to move the assignment to r4 down to the block where
it is used, but something will certainly do that, and it is one of the
shrink-wrapping improvements I want to do for GCC 10).

> It seems shrinkwrapping is more random, sometimes it's done as expected,
> sometimes it is not. It was more consistent on older GCC's.

Shrink-wrapping is very predictable.  But no block where a non-volatile
register is used or set will get shrink-wrapped.  This limitation has
existed since forever.

Reply via email to