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]

Yet another non-call-exceptions handling fix


Hi,
another crash, again GCSE.  THis time insert_insn_end_bb inserts insn
after trapping insn.  GCSE already do have code to handle abnormal calls
and jumps, so I've just updated it to handle trapping insns as well.

I am going to install it as obvious if it passes more checking
regtested/bootstrapped i686 together with previous patch.

OK for branch?

Thu Mar  7 15:24:11 CET 2002  Jan Hubicka  <jh@suse.cz>

	* gcse.c (insert_insn_end_bb): Handle trapping insns.

Index: gcse.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/gcse.c,v
retrieving revision 1.178
diff -c -3 -p -r1.178 gcse.c
*** gcse.c	2002/02/28 10:10:58	1.178
--- gcse.c	2002/03/07 14:18:33
*************** insert_insn_end_bb (expr, bb, pre)
*** 4609,4621 ****
    pat = process_insert_insn (expr);
  
    /* If the last insn is a jump, insert EXPR in front [taking care to
!      handle cc0, etc. properly].  */
  
!   if (GET_CODE (insn) == JUMP_INSN)
      {
  #ifdef HAVE_cc0
        rtx note;
  #endif
  
        /* If this is a jump table, then we can't insert stuff here.  Since
  	 we know the previous real insn must be the tablejump, we insert
--- 4613,4635 ----
    pat = process_insert_insn (expr);
  
    /* If the last insn is a jump, insert EXPR in front [taking care to
!      handle cc0, etc. properly].  Similary we need to care trapping
!      instructions in presence of non-call exceptions.  */
  
!   if (GET_CODE (insn) == JUMP_INSN
!       || (GET_CODE (insn) == INSN
! 	  && (bb->succ->succ_next || (bb->succ->flags & EDGE_ABNORMAL))))
      {
  #ifdef HAVE_cc0
        rtx note;
  #endif
+       /* It should always be the case that we can put these instructions
+ 	 anywhere in the basic block with performing PRE optimizations.
+ 	 Check this.  */
+       if (GET_CODE (insn) == insn && pre
+ 	  && !TEST_BIT (antloc[bb->index], expr->bitmap_index)
+           && !TEST_BIT (transp[bb->index], expr->bitmap_index))
+ 	abort ();
  
        /* If this is a jump table, then we can't insert stuff here.  Since
  	 we know the previous real insn must be the tablejump, we insert
*************** insert_insn_end_bb (expr, bb, pre)
*** 4645,4651 ****
  
    /* Likewise if the last insn is a call, as will happen in the presence
       of exception handling.  */
!   else if (GET_CODE (insn) == CALL_INSN)
      {
        /* Keeping in mind SMALL_REGISTER_CLASSES and parameters in registers,
  	 we search backward and place the instructions before the first
--- 4659,4666 ----
  
    /* Likewise if the last insn is a call, as will happen in the presence
       of exception handling.  */
!   else if (GET_CODE (insn) == CALL_INSN
! 	   && (bb->succ->succ_next || (bb->succ->flags & EDGE_ABNORMAL)))
      {
        /* Keeping in mind SMALL_REGISTER_CLASSES and parameters in registers,
  	 we search backward and place the instructions before the first


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