[Bug target/60520] stack adjustment are not merged anymore

hjl.tools at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Mar 14 15:45:00 GMT 2014


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

--- Comment #9 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Uroš Bizjak from comment #8)
> However, using "-O2 -m32 -fno-omit-frame-pointer" an unnecessary stack
> adjustment remains, even after r208551:
> 
> test:
>         movl    bar, %eax
>         movl    (%eax), %edx
>         testl   %edx, %edx
>         jne     .L7
>         ret
>         .p2align 4,,10
>         .p2align 3
>         pushl   %ebp
>         movl    %esp, %ebp
>         subl    $20, %esp
>         pushl   %eax
>         call    foo
>         addl    $16, %esp     <<<<
>         leave
>         ret

ix86_expand_epilogue restores SP and BP:

(insn 12 11 29 3 (parallel [
            (set (reg/f:SI 7 sp)
                (plus:SI (reg/f:SI 7 sp)
                    (const_int 16 [0x10])))
            (clobber (reg:CC 17 flags))
        ]) /tmp/p.i:7 253 {*addsi_1}
     (expr_list:REG_ARGS_SIZE (const_int 0 [0])
        (nil)))
(note 29 12 30 3 NOTE_INSN_EPILOGUE_BEG)
(insn/f 30 29 34 3 (parallel [
            (set (reg/f:SI 7 sp)
                (plus:SI (reg/f:SI 6 bp)
                    (const_int 4 [0x4])))
            (set (reg/f:SI 6 bp)
                (mem:SI (reg/f:SI 6 bp) [0  S4 A8]))
            (clobber (mem:BLK (scratch) [0  A8]))
        ]) /tmp/p.i:8 -1
     (expr_list:REG_CFA_RESTORE (reg/f:SI 6 bp)
        (expr_list:REG_CFA_DEF_CFA (plus:SI (reg/f:SI 7 sp)
                (const_int 4 [0x4]))
            (nil))))

But none of the passes after it kill insn 12.


More information about the Gcc-bugs mailing list