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]

[hubicka@ucw.cz: Re: EH notes and split instructions]


----- Forwarded message from Jan Hubicka <hubicka@ucw.cz> -----

From: Jan Hubicka <hubicka@ucw.cz>
To: Richard Henderson <rth@redhat.com>
Cc: Jan Hubicka <hubicka@ucw.cz>, Anthony Green <green@redhat.com>
Subject: Re: EH notes and split instructions

> On Tue, Feb 26, 2002 at 07:01:24PM +0100, Jan Hubicka wrote:
> > Perhaps I can get the EH edge from original insn, try each of new insns
> > whether they can trap and if so, attach copy of it.  Sounds right?
> 
> Yes.

Hi,
the guilty is somewhat crazy ordering of purge_dead_edges, that first
handles jumps and returns and then does care exception handling.
The patch reorders it.  Bootstrapped i386 on mainline, bootstrapping
branch. OK (mainline/branch)?

Honza

Tue Feb 26 19:35:06 CET 2002  Jan Hubicka  <jh@suse.cz>

	* cfgrtl.c (purge_dead_edges): Fix handling of EH edges.

Index: cfgrtl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cfgrtl.c,v
retrieving revision 1.29
diff -c -3 -p -r1.29 cfgrtl.c
*** cfgrtl.c	2002/02/12 21:39:41	1.29
--- cfgrtl.c	2002/02/26 18:30:03
*************** purge_dead_edges (bb)
*** 1897,1905 ****
    rtx insn = bb->end, note;
    bool purged = false;
  
!   /* ??? This makes no sense since the later test includes more cases.  */
!   if (GET_CODE (insn) == JUMP_INSN && !simplejump_p (insn))
!     return false;
  
    if (GET_CODE (insn) == JUMP_INSN)
      {
--- 1899,1928 ----
    rtx insn = bb->end, note;
    bool purged = false;
  
!   /* If this instruction cannot trap, remove REG_EH_REGION notes.  */
!   if (GET_CODE (insn) == INSN
!       && (note = find_reg_note (insn, REG_EH_REGION, NULL)))
!     {
!       rtx eqnote;
! 
!       if (! may_trap_p (PATTERN (insn))
! 	  || ((eqnote = find_reg_equal_equiv_note (insn))
! 	      && ! may_trap_p (XEXP (eqnote, 0))))
! 	remove_note (insn, note);
!     }
! 
!   /* Cleanup abnormal edges caused by throwing insns that have been
!      eliminated.  */
!   if (! can_throw_internal (bb->end))
!     for (e = bb->succ; e; e = next)
!       {
! 	next = e->succ_next;
! 	if (e->flags & EDGE_EH)
! 	  {
! 	    remove_edge (e);
! 	    purged = true;
! 	  }
!       }
  
    if (GET_CODE (insn) == JUMP_INSN)
      {
*************** purge_dead_edges (bb)
*** 1967,1997 ****
  
        return purged;
      }
- 
-   /* If this instruction cannot trap, remove REG_EH_REGION notes.  */
-   if (GET_CODE (insn) == INSN
-       && (note = find_reg_note (insn, REG_EH_REGION, NULL)))
-     {
-       rtx eqnote;
- 
-       if (! may_trap_p (PATTERN (insn))
- 	  || ((eqnote = find_reg_equal_equiv_note (insn))
- 	      && ! may_trap_p (XEXP (eqnote, 0))))
- 	remove_note (insn, note);
-     }
- 
-   /* Cleanup abnormal edges caused by throwing insns that have been
-      eliminated.  */
-   if (! can_throw_internal (bb->end))
-     for (e = bb->succ; e; e = next)
-       {
- 	next = e->succ_next;
- 	if (e->flags & EDGE_EH)
- 	  {
- 	    remove_edge (e);
- 	    purged = true;
- 	  }
-       }
  
    /* If we don't see a jump insn, we don't know exactly why the block would
       have been broken at this point.  Look for a simple, non-fallthru edge,
--- 1990,1995 ----

----- End forwarded message -----


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