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]

maybe_remove_dead_notes abort


Aftern turning on the peephole2 patterns on Alpha, I got an abort
when the thing triggers.  (I didn't get this with the new genrecog
I'm playing with, just the old one.  Hmm... another bug?)

I can't evern figure out what the old code was thinking.  Surely
completely optimizing away a register is something someone might
want to do.  The old code aborts in all non-nop cases.

I'm not sure what the best thing to do is.  I'm sure this isn't
it, but I'm not sure what else to do --

Rather than trying to track down the last places the register 
was used and update things, I just add a dummy clobber insn to
hang a lone reg_dead note.

Thoughts?



r~


	* flow.c (maybe_remove_dead_notes): Don't abort if the reg is
	no longer used; just kill it with a clobber.

Index: flow.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/flow.c,v
retrieving revision 1.161
diff -c -p -d -r1.161 flow.c
*** flow.c	1999/09/23 15:07:25	1.161
--- flow.c	1999/10/01 08:16:34
*************** maybe_remove_dead_notes (set_insn, set, 
*** 5943,5975 ****
      }
    else if (set_type == 0)
      {
!       /* The reg is not being set or used in the new insns at all. */
!       int i, regno;
! 
!       /* Should never reach here for a pseudo reg.  */
!       if (REGNO (set_dest) >= FIRST_PSEUDO_REGISTER)
! 	abort ();
! 
!       /* This can happen for a hard register, if the new insns do not
! 	 contain instructions which would be no-ops referring to the
! 	 old registers. 
! 
! 	 We try to verify that this is the case by checking to see if
! 	 the original instruction uses all of the registers that it
! 	 set. This case is OK, because deleting a no-op can not affect
! 	 REG_DEAD notes on other insns. If this is not the case, then
! 	 abort.  */
  
!       regno = REGNO (set_dest);
!       for (i = HARD_REGNO_NREGS (regno, GET_MODE (set_dest)) - 1;
! 	   i >= 0; i--)
! 	{
! 	  if (! refers_to_regno_p (regno + i, regno + i + 1, set,
! 				   NULL_PTR))
! 	    break;
! 	}
!       if (i >= 0)
! 	abort ();
      }
  }
  
--- 5943,5956 ----
      }
    else if (set_type == 0)
      {
!       /* The reg is not being set or used in the new insns at all.  */
!       /* ??? Rather than let the register stay live, or backtracking to
! 	 find the death insn properly, kill it by adding a clobber
! 	 before FIRST_INSN.  */
  
!       set = emit_insn_before (gen_rtx_CLOBBER (set_dest), first_insn);
!       REG_NOTES (set)
! 	= gen_rtx_EXPR_LIST (REG_DEAD, set_dest, REG_NOTES (set));
      }
  }
  


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