peephole2: dead regs not marked as dead

Paolo Bonzini bonzini@gnu.org
Tue Oct 26 18:06:00 GMT 2010


On 10/26/2010 07:42 PM, Georg Lay wrote:
> I set a break at the end of df_simulate_one_insn_backwards.
> CURRENT = *(live->current->bits)
> FIRST   = *(live->first->bits)

Or call debug_bitmap (). :)

> reg 26 (Stackpointer) and reg 27 (return address) do not matter here.
> The result ist
>
> insn 10 (CALL)   CURRENT = FIRST = 0xc008010 = {...,4,15}

Ok, this looks like a bug somewhere (either in DF or in your backend).

One reason could be an artificial use at the bottom of the basic block. 
  This seems strange because the implicit restore of the register in the 
epilogue would be a definition, not a use.  Anyway, can you print the 
liveness bitmap after df_simulate_initialize_backwards?

I also don't see any reason why insn 10 should use d15, though.  To 
exclude this, can you walk through df_simulate_defs and df_simulate_uses 
for insn 10, and print (p *def / p *use respectively) each of the defs 
and uses that they encounter?

> insn 21 (SET)    CURRENT = FIRST = 0xc008000 = {...,15}
> insn 23 (XOR)    CURRENT = FIRST = 0xc008010 = {...,4,15}
> insn 22 (AND)    CURRENT = FIRST = 0xc000010 = {...,4}
>
> So 15 is still alive at the call insn.

Since liveness is being computed backwards, it's better to think about 
it as "already" being alive. Since it is not alive at the end of the 
basic block (in the dump it's not part of "lr out"), it must have been 
added either by df_simulate_initialize_backwards, or by 
df_simulate_one_insn_backwards on the CALL insn.

I followed up offlist with the copyright form.

Paolo



More information about the Gcc mailing list