I'm not completely following this yet, so please bear with me...

On 10/09/11 10:01, Richard Sandiford wrote:
> Reload 0: GR_REGS, RELOAD_FOR_OUTPUT_ADDRESS (opnum = 0), can't combine, 
> secondary_reload_p
>         reload_reg_rtx: (reg:SI 5 $5)
> Reload 1: reload_out (SI) = (reg:SI 32 $f0 [1655])
>         MD1_REG, RELOAD_FOR_OUTPUT (opnum = 0)
>         reload_out_reg: (reg:SI 32 $f0 [1655])
>         reload_reg_rtx: (reg:SI 65 lo)
>         secondary_out_reload = 0
> 
> Reload 2: reload_out (SI) = (reg:SI 1656)
>         GR_REGS, RELOAD_FOR_OUTPUT (opnum = 3)
>         reload_out_reg: (reg:SI 1656)
>         reload_reg_rtx: (reg:SI 5 $5)
> 
> So $5 is first stored in 1656 (operand 3), then $5 is used a secondary
> reload in copying LO to $f0 (operand 0, reg 1655).  The next and final
> use of 1655 ends up inheriting this second reload of $5, so we try to
> delete the original output copy.  The problem is that we delete the
> wrong one: we delete the store of $5 to 1656 rather than the copy of
> $5 to 1655/$f0.

So, reload 1 inherited from somewhere else rather than using reg $5 from
its secondary reload? Where do we try to delete the insn, and what's the
state of the spill_reg_store data at that point?

> The fix I went for is to clear new_spill_reg_store[] for all reloads
> as a separate pass (rather than in the main do_{input,output}_reload
> loop), then only allow new_spill_store_reg[] to be set if the associated
> reload register reaches the end of the reload sequence.

In this case, reload 0 is emitted after reload 2, so it reaches the end.
Correct? What would happen if the 0/1 pair and 2 were swapped?


Bernd

Reply via email to