[Bug rtl-optimization/64895] [5 Regression] RA picks the wrong register for -fipa-ra

hjl.tools at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun Feb 1 19:25:00 GMT 2015


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

--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
From

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64342#c9

The test fails due to different and orthogonal issue: RA chooses %ebx for a
temporary when -fpic is used:

        movl    %eax, %ebx
        call    bar
        addl    %ebx, %eax

The push and pop insns are from prologue/epilogue since call-saved reg is used
(%ebx), not due to save/restore the reg around the call:

(note 3 4 19 2 NOTE_INSN_FUNCTION_BEG)
(insn/f:TI 19 3 20 2 (set (mem:SI (pre_dec:SI (reg/f:SI 7 sp)) [0  S4 A8])
        (reg:SI 3 bx)) fuse-caller-save.c:16 66 {*pushsi2}
     (expr_list:REG_DEAD (reg:SI 3 bx)
        (nil)))
(note 20 19 2 2 NOTE_INSN_PROLOGUE_END)
...
(note 27 15 24 2 NOTE_INSN_EPILOGUE_BEG)
(insn/f:TI 24 27 25 2 (set (reg:SI 3 bx)
        (mem:SI (post_inc:SI (reg/f:SI 7 sp)) [0  S4 A8]))
fuse-caller-save.c:18 74 {*popsi1}
     (expr_list:REG_CFA_ADJUST_CFA (set (reg/f:SI 7 sp)
            (plus:SI (reg/f:SI 7 sp)
                (const_int 4 [0x4])))
        (expr_list:REG_CFA_RESTORE (reg:SI 3 bx)
            (nil))))

So, please open a new PR due to RA issue: since %edx was allocated for PIC
register (but later removed), another call-used (%ecx) should be used here.



More information about the Gcc-bugs mailing list