This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


> 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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]