Compile the attached source code with options -Os -mthumb, gcc generates:

sort_basket:
        push    {r4, r5, r6, r7, lr}
        sub     sp, sp, #20
        str     r1, [sp, #8]         // A
        b       .L10
.L13:
        mov     r0, r4
.L10:
        ldr     r1, [sp, #8]
        add     r3, r0, r1
...

Instruction A spills parameter into stack, it is always executed at the start
of the function, so it can be merged into the function prologue

push    {r1, r4, r5, r6, r7, lr}


-- 
           Summary: Parameter spilling can be merged into function prologue
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: carrot at google dot com
 GCC build triplet: i686-linux
  GCC host triplet: i686-linux
GCC target triplet: arm-eabi


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42486

Reply via email to