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]

[committed] rewrite of last cfgrtl.c patch


My fix for PR 17356 was bothering me, as I didn't fully understand the
code before I changed it.  So I went back and took another closer look,
and figured out that my first patch wasn't completely correct.  This
removes my previous patch, and just adds two new lines
!             && (! (e->flags & EDGE_ABNORMAL_CALL)
!                 || CALL_P (BB_END (bb))))
This fixes the original problem where we weren't removing abnormal call
EH edges for blocks that needed an EH edge, but did not end with a
CALL_INSN.  I also added comments, to explain the part I didn't not
understand the first time I looked at this code.

This was tested with an ia64-linux bootstrap and make check for all
default languages plus Ada.  There were no regressions.
-- 
Jim Wilson, GNU Tools Support, http://www.specifix.com
2005-10-25  James E. Wilson  <wilson@specifix.com>

	PR rtl-optimization/17356
	*  cfgrtl.c (purge_dead_edges): Undo last change.  In EDGE_EH code,
	add check for CALL_INSN if EDGE_ABRNOMAL_CALL true.

Index: cfgrtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgrtl.c,v
retrieving revision 1.183
diff -p -p -r1.183 cfgrtl.c
*** cfgrtl.c	19 Oct 2005 14:42:10 -0000	1.183
--- cfgrtl.c	25 Oct 2005 18:12:39 -0000
*************** purge_dead_edges (basic_block bb)
*** 2294,2316 ****
    /* Cleanup abnormal edges caused by exceptions or non-local gotos.  */
    for (ei = ei_start (bb->succs); (e = ei_safe_edge (ei)); )
      {
!       /* We must check for the most restrictive condition first.  Since
! 	 an abnormal call edge is always an EH edge, but an EH edge is not
! 	 always an abnormal call edge, we must check for an abnormal call
! 	 edge first.  */
!       if (e->flags & EDGE_ABNORMAL_CALL)
! 	{
! 	  if (CALL_P (BB_END (bb))
! 	      && (! (note = find_reg_note (insn, REG_EH_REGION, NULL))
! 		  || INTVAL (XEXP (note, 0)) >= 0))
  	    {
  	      ei_next (&ei);
  	      continue;
  	    }
  	}
!       else if (e->flags & EDGE_EH)
  	{
! 	  if (can_throw_internal (BB_END (bb)))
  	    {
  	      ei_next (&ei);
  	      continue;
--- 2294,2318 ----
    /* Cleanup abnormal edges caused by exceptions or non-local gotos.  */
    for (ei = ei_start (bb->succs); (e = ei_safe_edge (ei)); )
      {
!       /* There are three types of edges we need to handle correctly here: EH
! 	 edges, abnormal call EH edges, and abnormal call non-EH edges.  The
! 	 latter can appear when nonlocal gotos are used.  */
!       if (e->flags & EDGE_EH)
! 	{
! 	  if (can_throw_internal (BB_END (bb))
! 	      /* If this is a call edge, verify that this is a call insn.  */
! 	      && (! (e->flags & EDGE_ABNORMAL_CALL)
! 		  || CALL_P (BB_END (bb))))
  	    {
  	      ei_next (&ei);
  	      continue;
  	    }
  	}
!       else if (e->flags & EDGE_ABNORMAL_CALL)
  	{
! 	  if (CALL_P (BB_END (bb))
! 	      && (! (note = find_reg_note (insn, REG_EH_REGION, NULL))
! 		  || INTVAL (XEXP (note, 0)) >= 0))
  	    {
  	      ei_next (&ei);
  	      continue;

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