This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: peephole2: dead regs not marked as dead
On 10/27/2010 04:30 PM, Georg Lay wrote:
The first time it occurs in "exit block uses" is in pro/epilogue:
peep2.c.193r.split2:;; exit block uses 2 [d2] 26 [SP] 27 [a11]
peep2.c.195r.pro_and_epilogue:;; exit block uses 2 [d2] 15 [d15] 26 [SP]
27 [a11]
peep2.c.196r.dse2:;; exit block uses 2 [d2] 15 [d15] 26 [SP] 27 [a11]
peep2.c.196r.dse2:;; exit block uses 2 [d2] 15 [d15] 26 [SP] 27 [a11]
Oh, that helps a lot: this is what df_get_exit_block_use_set says:
if (HAVE_epilogue && epilogue_completed)
{
/* Mark all call-saved registers that we actually used. */
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
if (df_regs_ever_live_p (i) && !LOCAL_REGNO (i)
&& !TEST_HARD_REG_BIT (regs_invalidated_by_call, i))
bitmap_set_bit (exit_block_uses, i);
}
These uses are needed to ensure that, if restores of call-saved
registers are explicitly in the RTL for the epilogue, they are not
considered dead. However, they make d15 live.
It looks like you need to represent the definition of call-saved
registers explicitly in the RTL for the epilogue. These definitions
will make d15 dead as you expect, and you need them even if they will
not output any assembly.
In this sense, this is a backend bug: you are not making the RTL stream
accurate, and it's biting you. I acknowledge it's quite tricky; from
what I understood it happens because of a peculiarity of your
architecture with respect to callee-save registers (d15 is automatically
save/restored, or something like that).
Paolo