This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] postreload: Invalidate reg_state info@barrier/volatile insns
- From: "Andreas Krebbel" <krebbel at linux dot vnet dot ibm dot com>
- To: Eric Botcazou <ebotcazou at adacore dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 21 Nov 2011 12:54:33 +0100
- Subject: Re: [PATCH] postreload: Invalidate reg_state info@barrier/volatile insns
- References: <20111114172842.GA8835@bart> <201111182220.04644.ebotcazou@adacore.com>
> Let's be conservative instead and distinguish the two cases: in the barrier
> case, we don't change anything and just add the missing comment, along the
> lines of "Crossing a barrier resets all the use information". In the volatile
> case, we unconditionally invalidate with a similar comment.
Ok. Here is an updated version.
Bootstrapped and regtested on s390x and x86_64.
Ok for mainline?
Bye,
-Andreas-
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.
Index: gcc/postreload.c
===================================================================
*** gcc/postreload.c.orig
--- gcc/postreload.c
*************** reload_combine (void)
*** 1312,1322 ****
is and then later disable any optimization that would cross it. */
if (LABEL_P (insn))
last_label_ruid = reload_combine_ruid;
! else if (BARRIER_P (insn)
! || (INSN_P (insn) && volatile_insn_p (PATTERN (insn))))
! for (r = 0; r < FIRST_PSEUDO_REGISTER; r++)
! if (! fixed_regs[r])
reg_state[r].use_index = RELOAD_COMBINE_MAX_USES;
if (! NONDEBUG_INSN_P (insn))
continue;
--- 1312,1332 ----
is and then later disable any optimization that would cross it. */
if (LABEL_P (insn))
last_label_ruid = reload_combine_ruid;
! else if (BARRIER_P (insn))
! {
! /* Crossing a barrier resets all the use information. */
! for (r = 0; r < FIRST_PSEUDO_REGISTER; r++)
! if (! fixed_regs[r])
reg_state[r].use_index = RELOAD_COMBINE_MAX_USES;
+ }
+ 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++)
+ if (! fixed_regs[r]
+ && reg_state[r].use_index != RELOAD_COMBINE_MAX_USES)
+ reg_state[r].use_index = -1;
if (! NONDEBUG_INSN_P (insn))
continue;