c/7871: ICE on legal code, global register variables problems

Jim Wilson wilson@tuliptree.org
Fri Feb 28 16:43:00 GMT 2003

On Fri, 2003-02-28 at 00:47, Richard Henderson wrote:
>           /* Calls may also reference any of the global registers,
>              so they are made live.  */
>           for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
>             if (global_regs[i])
>               mark_used_reg (pbi, regno_reg_rtx[i], cond, insn);

We first call mark_set_1 (... CLOBBER...) which kills the register.
Then we call mark_used_reg which makes it live again, and adds a
REG_DEAD note to the call.  This REG_DEAD note is wrong.  This confuses
combine into deleting the instruction because there is a REG_DEAD note
for it and no visible use of it after combination.  It doesn't seem
right to modify combine to treat REG_DEAD notes for global regs
specially.  I think we need to avoid adding the REG_DEAD note in the
first place.

Maybe what we should do here is call mark_set_reg (...SET...) for global
regs instead of mark_set_1 (...CLOBBER...).  I think this might work.  I
will try this.  I have some other easier patches to deal with, so I will
get back to this later.


More information about the Gcc-bugs mailing list