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: fix alpha eh regressions


On Mon, Mar 25, 2002 at 09:49:08AM +0100, Jan Hubicka wrote:
> For mainline we should probably use the dirty blocks, as they can avoid
> recomputing in blocks we didn't changed anything.

Um, sure.  Makes the conditional execution case easier as well.  At the
moment it's convenient for me to apply the same patch both places...

Somehow I think I managed to make check without rebuilding the libraries,
as a subsequent rebuild from scratch blew up.  I need this additional
patch to build libjava.  Testing will proceed overnight.


r~


	* recog.c (peephole2_optimize): Distribute EH_REGION -1 notes
	anywhere in the block.  Don't refer to insns that have been
	removed from the chain.  Iterate backward through the new insns.
	Don't refer to edges that have been removed.

Index: recog.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/recog.c,v
retrieving revision 1.137.2.2
diff -c -p -d -r1.137.2.2 recog.c
*** recog.c	2002/03/25 00:05:05	1.137.2.2
--- recog.c	2002/03/25 08:42:17
*************** peephole2_optimize (dump_file)
*** 3064,3070 ****
  	  prev = PREV_INSN (insn);
  	  if (INSN_P (insn))
  	    {
! 	      rtx try;
  	      int match_len;
  	      rtx note;
  
--- 3064,3070 ----
  	  prev = PREV_INSN (insn);
  	  if (INSN_P (insn))
  	    {
! 	      rtx try, before_try;
  	      int match_len;
  	      rtx note;
  
*************** peephole2_optimize (dump_file)
*** 3147,3160 ****
  		  if (i >= MAX_INSNS_PER_PEEP2 + 1)
  		    i -= MAX_INSNS_PER_PEEP2 + 1;
  
  		  /* Replace the old sequence with the new.  */
  		  try = emit_insn_after (try, peep2_insn_data[i].insn);
  		  delete_insn_chain (insn, peep2_insn_data[i].insn);
  
  		  /* Re-insert the EH_REGION notes.  */
! 		  if (try == bb->end
! 		      && (note = find_reg_note (peep2_insn_data[i].insn, 
! 						REG_EH_REGION, NULL_RTX)))
  		    {
  		      rtx x;
  		      edge eh_edge;
--- 3147,3162 ----
  		  if (i >= MAX_INSNS_PER_PEEP2 + 1)
  		    i -= MAX_INSNS_PER_PEEP2 + 1;
  
+ 		  note = find_reg_note (peep2_insn_data[i].insn, 
+ 					REG_EH_REGION, NULL_RTX);
+ 
  		  /* Replace the old sequence with the new.  */
  		  try = emit_insn_after (try, peep2_insn_data[i].insn);
+ 		  before_try = PREV_INSN (insn);
  		  delete_insn_chain (insn, peep2_insn_data[i].insn);
  
  		  /* Re-insert the EH_REGION notes.  */
! 		  if (note)
  		    {
  		      rtx x;
  		      edge eh_edge;
*************** peephole2_optimize (dump_file)
*** 3164,3174 ****
  			if (eh_edge->flags & EDGE_EH)
  			  break;
  
! 		      for (x = NEXT_INSN (peep2_insn_data[i].insn);
! 			   x != NEXT_INSN (try); x = NEXT_INSN (x))
  			if (GET_CODE (x) == CALL_INSN
  			    || (flag_non_call_exceptions
! 				&& may_trap_p (PATTERN (x))))
  			  {
  			    REG_NOTES (x)
  			      = gen_rtx_EXPR_LIST (REG_EH_REGION,
--- 3166,3176 ----
  			if (eh_edge->flags & EDGE_EH)
  			  break;
  
! 		      for (x = try ; x != before_try ; x = PREV_INSN (x))
  			if (GET_CODE (x) == CALL_INSN
  			    || (flag_non_call_exceptions
! 				&& may_trap_p (PATTERN (x))
! 				&& !find_reg_note (x, REG_EH_REGION, NULL)))
  			  {
  			    REG_NOTES (x)
  			      = gen_rtx_EXPR_LIST (REG_EH_REGION,
*************** peephole2_optimize (dump_file)
*** 3177,3185 ****
  
  			    if (x != bb->end && eh_edge)
  			      {
! 				edge nfte = split_block (bb, x);
! 				edge nehe = make_edge (nfte->src, eh_edge->dest,
! 						       eh_edge->flags);
  				nehe->probability = eh_edge->probability;
  				nfte->probability
  				  = REG_BR_PROB_BASE - nehe->probability;
--- 3179,3194 ----
  
  			    if (x != bb->end && eh_edge)
  			      {
! 				edge nfte, nehe;
! 				int flags;
! 
! 				nfte = split_block (bb, x);
! 				flags = EDGE_EH | EDGE_ABNORMAL;
! 				if (GET_CODE (x) == CALL_INSN)
! 				  flags |= EDGE_ABNORMAL_CALL;
! 				nehe = make_edge (nfte->src, eh_edge->dest,
! 						  flags);
! 
  				nehe->probability = eh_edge->probability;
  				nfte->probability
  				  = REG_BR_PROB_BASE - nehe->probability;
*************** peephole2_optimize (dump_file)
*** 3190,3195 ****
--- 3199,3205 ----
  				changed = true;
  #endif
  				bb = nfte->src;
+ 				eh_edge = nehe;
  			      }
  			  }
  


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