[PATCH] postreload: Invalidate reg_state info@barrier/volatile insns

Andreas Krebbel krebbel@linux.vnet.ibm.com
Mon Nov 21 13:34:00 GMT 2011


On 11/21/2011 01:12 PM, Eric Botcazou wrote:
>> 2011-11-21  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
>>
>> 	* postreload.c (reload_combine): Mark reg_state as invalid at
>> 	volatile insns if there has been a use already.
> 
> What do we gain in practice by invalidating conditionally?  Probably nothing 
> I'd say, so let's invalidate unconditionally like for CALL_P just below.
> 
> +       else if (INSN_P (insn) && volatile_insn_p (PATTERN (insn)))
> +       /* Optimizations across insns being marked as volatile must be
> +          prevented.  All the usage information is invalidated here.  */
> +       for (r = 0; r < FIRST_PSEUDO_REGISTER; r++)
> +           reg_state[r].use_index = -1;

Wouldn't this prevent optimizations in cases like:

insn 1: r1 = r2 + r3
insn 2: r4 = r1, r1 dead
insn 3: unspec_volatile

With the proposal above we would mark r1 with an invalid use when passing insn 3. But for
registers which are already dead we should not do this. They should just stay dead.

Bye,

-Andreas-



More information about the Gcc-patches mailing list