scheduling problems again

Mike Stump mrs@wrs.com
Wed Jan 28 14:54:00 GMT 1998


> To: mrs@wrs.com (Mike Stump)
> cc: egcs@cygnus.com
> Date: Wed, 28 Jan 1998 00:05:22 -0700
> From: Jeffrey A Law <law@hurl.cygnus.com>

> I'd just change it to ignore REG_DEAD notes after reload instead of
> aborting.  There's still cases where it would be useful if it
> ignored such notes.

Ah, true.  How's this:

1998-01-28  Mike Stump  <mrs@wrs.com>

	* rtlanal.c (dead_or_set_regno_p): Ignore REG_DEAD notes after
	reload completes, as REG_DEAD notes are not maintained after
	reload completes and may be inaccurate.

Doing diffs in gcc/rtlanal.c.~1~:
*** gcc/rtlanal.c.~1~	Thu Jan 15 17:20:49 1998
--- gcc/rtlanal.c	Wed Jan 28 09:41:57 1998
*************** dead_or_set_regno_p (insn, test_regno)
*** 1157,1175 ****
    int regno, endregno;
    rtx link;
  
!   /* See if there is a death note for something that includes TEST_REGNO.  */
!   for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
      {
!       if (REG_NOTE_KIND (link) != REG_DEAD || GET_CODE (XEXP (link, 0)) != REG)
! 	continue;
  
!       regno = REGNO (XEXP (link, 0));
!       endregno = (regno >= FIRST_PSEUDO_REGISTER ? regno + 1
! 		  : regno + HARD_REGNO_NREGS (regno,
! 					      GET_MODE (XEXP (link, 0))));
  
!       if (test_regno >= regno && test_regno < endregno)
! 	return 1;
      }
  
    if (GET_CODE (insn) == CALL_INSN
--- 1157,1182 ----
    int regno, endregno;
    rtx link;
  
!   /* REG_READ notes are not maintained after reload, so we ignore
!      them.  */
!   if (! reload_completed)
      {
!       /* See if there is a death note for something that includes
!          TEST_REGNO.  */
!       for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
! 	{
! 	  if (REG_NOTE_KIND (link) != REG_DEAD
! 	      || GET_CODE (XEXP (link, 0)) != REG)
! 	    continue;
  
! 	  regno = REGNO (XEXP (link, 0));
! 	  endregno = (regno >= FIRST_PSEUDO_REGISTER ? regno + 1
! 		      : regno + HARD_REGNO_NREGS (regno,
! 						  GET_MODE (XEXP (link, 0))));
  
! 	  if (test_regno >= regno && test_regno < endregno)
! 	    return 1;
! 	}
      }
  
    if (GET_CODE (insn) == CALL_INSN
--------------


If that goes in, then we can actually remove the two sets of patches
that I just submitted, they will be wrong.  patch -R these:

Doing diffs in .:
*** ./gcc/config/m32r/m32r.md.~1~	Thu Jan 15 17:31:15 1998
--- ./gcc/config/m32r/m32r.md	Tue Jan 27 22:44:42 1998
***************
*** 379,384 ****
--- 379,386 ----
  	{
  	  /* Try to use auto-inc addressing if we can.  */
  	  if (GET_CODE (XEXP (operands[1], 0)) == REG
+ /* ??? This is WRONG, dead_or_set_p cannot be used after reload
+    because the REG_DEAD notes are not maintained after reload.  */
  	      && dead_or_set_p (insn, XEXP (operands[1], 0)))
  	    {
  	      operands[1] = XEXP (operands[1], 0);
***************
*** 389,394 ****
--- 391,398 ----
      case 3 :
        /* Try to use auto-inc addressing if we can.  */
        if (GET_CODE (XEXP (operands[0], 0)) == REG
+ /* ??? This is WRONG, dead_or_set_p cannot be used after reload
+    because the REG_DEAD notes are not maintained after reload.  */
  	  && dead_or_set_p (insn, XEXP (operands[0], 0)))
  	{
  	  operands[0] = XEXP (operands[0], 0);
***************
*** 530,535 ****
--- 534,541 ----
  	{
  	  /* Try to use auto-inc addressing if we can.  */
  	  if (GET_CODE (XEXP (operands[1], 0)) == REG
+ /* ??? This is WRONG, dead_or_set_p cannot be used after reload
+    because the REG_DEAD notes are not maintained after reload.  */
  	      && dead_or_set_p (insn, XEXP (operands[1], 0)))
  	    {
  	      operands[1] = XEXP (operands[1], 0);
***************
*** 540,545 ****
--- 546,553 ----
      case 3 :
        /* Try to use auto-inc addressing if we can.  */
        if (GET_CODE (XEXP (operands[0], 0)) == REG
+ /* ??? This is WRONG, dead_or_set_p cannot be used after reload
+    because the REG_DEAD notes are not maintained after reload.  */
  	  && dead_or_set_p (insn, XEXP (operands[0], 0)))
  	{
  	  operands[0] = XEXP (operands[0], 0);
--------------


Doing diffs in .:
*** ./gcc/config/m32r/m32r.md.~1~	Thu Jan 15 17:31:15 1998
--- ./gcc/config/m32r/m32r.md	Tue Jan 27 21:00:22 1998
***************
*** 1463,1468 ****
--- 1463,1470 ----
    [(set (mem:SI (plus:SI (match_operand:SI 0 "register_operand" "r")
  			 (const_int 4)))
          (match_operand:SI 1 "register_operand" "r"))]
+ ;; ??? This is WRONG, dead_or_set_p cannot be used after reload
+ ;; because the REG_DEAD notes are not maintained after reload.
    "dead_or_set_p (insn, operands[0])"
    "st %1,@+%0"
    [(set_attr "type" "store")
*** ./gcc/config/mips/mips.md.~1~	Fri Jan 23 15:54:32 1998
--- ./gcc/config/mips/mips.md	Tue Jan 27 21:01:25 1998
*************** move\\t%0,%z4\\n\\
*** 9771,9776 ****
--- 9771,9778 ----
    "TARGET_MIPS16
     && GET_CODE (operands[0]) == REG
     && REGNO (operands[0]) == 24
+ ;; ??? This is WRONG, dead_or_set_p cannot be used after reload
+ ;; because the REG_DEAD notes are not maintained after reload.
     && dead_or_set_p (insn, operands[0])
     && GET_CODE (operands[1]) == REG
     && M16_REG_P (REGNO (operands[1]))"
*************** move\\t%0,%z4\\n\\
*** 9796,9801 ****
--- 9798,9805 ----
    "TARGET_MIPS16 && TARGET_64BIT
     && GET_CODE (operands[0]) == REG
     && REGNO (operands[0]) == 24
+ ;; ??? This is WRONG, dead_or_set_p cannot be used after reload
+ ;; because the REG_DEAD notes are not maintained after reload.
     && dead_or_set_p (insn, operands[0])
     && GET_CODE (operands[1]) == REG
     && M16_REG_P (REGNO (operands[1]))"
*************** move\\t%0,%z4\\n\\
*** 9827,9832 ****
--- 9831,9838 ----
     && REGNO (operands[1]) == 24
     && GET_CODE (operands[0]) == REG
     && M16_REG_P (REGNO (operands[0]))
+ ;; ??? This is WRONG, dead_or_set_p cannot be used after reload
+ ;; because the REG_DEAD notes are not maintained after reload.
     && dead_or_set_p (insn, operands[0])"
    "*
  {
*************** move\\t%0,%z4\\n\\
*** 9852,9857 ****
--- 9858,9865 ----
     && REGNO (operands[1]) == 24
     && GET_CODE (operands[0]) == REG
     && M16_REG_P (REGNO (operands[0]))
+ ;; ??? This is WRONG, dead_or_set_p cannot be used after reload
+ ;; because the REG_DEAD notes are not maintained after reload.
     && dead_or_set_p (insn, operands[0])"
    "*
  {
*** ./gcc/config/mn10200/mn10200.md.~1~	Thu Jan 15 17:34:07 1998
--- ./gcc/config/mn10200/mn10200.md	Tue Jan 27 21:01:58 1998
***************
*** 1888,1893 ****
--- 1888,1895 ----
     (set (pc) (if_then_else (ge (cc0) (const_int 0))
  			   (match_operand 1 "" "")
  			   (pc)))]
+ ;; ??? This is WRONG, dead_or_set_p cannot be used after reload
+ ;; because the REG_DEAD notes are not maintained after reload.
    "dead_or_set_p (ins1, operands[0]) && REG_OK_FOR_INDEX_P (operands[0])"
    "add %0,%0\;bcc %1"
    [(set_attr "cc" "clobber")])
***************
*** 1897,1902 ****
--- 1899,1906 ----
     (set (pc) (if_then_else (lt (cc0) (const_int 0))
  			   (match_operand 1 "" "")
  			   (pc)))]
+ ;; ??? This is WRONG, dead_or_set_p cannot be used after reload
+ ;; because the REG_DEAD notes are not maintained after reload.
    "dead_or_set_p (ins1, operands[0]) && REG_OK_FOR_INDEX_P (operands[0])"
    "add %0,%0\;bcs %1"
    [(set_attr "cc" "clobber")])
***************
*** 1906,1911 ****
--- 1910,1917 ----
     (set (pc) (if_then_else (ge (cc0) (const_int 0))
  			   (pc)
  			   (match_operand 1 "" "")))]
+ ;; ??? This is WRONG, dead_or_set_p cannot be used after reload
+ ;; because the REG_DEAD notes are not maintained after reload.
    "dead_or_set_p (ins1, operands[0]) && REG_OK_FOR_INDEX_P (operands[0])"
    "add %0,%0\;bcs %1"
    [(set_attr "cc" "clobber")])
***************
*** 1915,1920 ****
--- 1921,1928 ----
     (set (pc) (if_then_else (lt (cc0) (const_int 0))
  			   (pc)
  			   (match_operand 1 "" "")))]
+ ;; ??? This is WRONG, dead_or_set_p cannot be used after reload
+ ;; because the REG_DEAD notes are not maintained after reload.
    "dead_or_set_p (ins1, operands[0]) && REG_OK_FOR_INDEX_P (operands[0])"
    "add %0,%0\;bcc %1"
    [(set_attr "cc" "clobber")])
***************
*** 1924,1929 ****
--- 1932,1939 ----
     (set (pc) (if_then_else (ge (cc0) (const_int 0))
  			   (match_operand 1 "" "")
  			   (pc)))]
+ ;; ??? This is WRONG, dead_or_set_p cannot be used after reload
+ ;; because the REG_DEAD notes are not maintained after reload.
    "dead_or_set_p (ins1, operands[0]) && REG_OK_FOR_INDEX_P (operands[0])"
    "add %0,%0\;bccx %1"
    [(set_attr "cc" "clobber")])
***************
*** 1933,1938 ****
--- 1943,1950 ----
     (set (pc) (if_then_else (lt (cc0) (const_int 0))
  			   (match_operand 1 "" "")
  			   (pc)))]
+ ;; ??? This is WRONG, dead_or_set_p cannot be used after reload
+ ;; because the REG_DEAD notes are not maintained after reload.
    "dead_or_set_p (ins1, operands[0]) && REG_OK_FOR_INDEX_P (operands[0])"
    "add %0,%0\;bcsx %1"
    [(set_attr "cc" "clobber")])
***************
*** 1942,1947 ****
--- 1954,1961 ----
     (set (pc) (if_then_else (ge (cc0) (const_int 0))
  			   (pc)
  			   (match_operand 1 "" "")))]
+ ;; ??? This is WRONG, dead_or_set_p cannot be used after reload
+ ;; because the REG_DEAD notes are not maintained after reload.
    "dead_or_set_p (ins1, operands[0]) && REG_OK_FOR_INDEX_P (operands[0])"
    "add %0,%0\;bcsx %1"
    [(set_attr "cc" "clobber")])
***************
*** 1951,1956 ****
--- 1965,1972 ----
     (set (pc) (if_then_else (lt (cc0) (const_int 0))
  			   (pc)
  			   (match_operand 1 "" "")))]
+ ;; ??? This is WRONG, dead_or_set_p cannot be used after reload
+ ;; because the REG_DEAD notes are not maintained after reload.
    "dead_or_set_p (ins1, operands[0]) && REG_OK_FOR_INDEX_P (operands[0])"
    "add %0,%0\;bccx %1"
    [(set_attr "cc" "clobber")])
*** ./gcc/config/mn10300/mn10300.md.~1~	Thu Jan 15 17:34:18 1998
--- ./gcc/config/mn10300/mn10300.md	Tue Jan 27 21:01:57 1998
***************
*** 1397,1402 ****
--- 1397,1404 ----
     (set (pc) (if_then_else (ge (cc0) (const_int 0))
  			   (match_operand 1 "" "")
  			   (pc)))]
+ ;; ??? This is WRONG, dead_or_set_p cannot be used after reload
+ ;; because the REG_DEAD notes are not maintained after reload.
    "dead_or_set_p (ins1, operands[0]) && REG_OK_FOR_INDEX_P (operands[0])"
    "add %0,%0\;bcc %1"
    [(set_attr "cc" "clobber")])
***************
*** 1406,1411 ****
--- 1408,1415 ----
     (set (pc) (if_then_else (lt (cc0) (const_int 0))
  			   (match_operand 1 "" "")
  			   (pc)))]
+ ;; ??? This is WRONG, dead_or_set_p cannot be used after reload
+ ;; because the REG_DEAD notes are not maintained after reload.
    "dead_or_set_p (ins1, operands[0]) && REG_OK_FOR_INDEX_P (operands[0])"
    "add %0,%0\;bcs %1"
    [(set_attr "cc" "clobber")])
***************
*** 1415,1420 ****
--- 1419,1426 ----
     (set (pc) (if_then_else (ge (cc0) (const_int 0))
  			   (pc)
  			   (match_operand 1 "" "")))]
+ ;; ??? This is WRONG, dead_or_set_p cannot be used after reload
+ ;; because the REG_DEAD notes are not maintained after reload.
    "dead_or_set_p (ins1, operands[0]) && REG_OK_FOR_INDEX_P (operands[0])"
    "add %0,%0\;bcs %1"
    [(set_attr "cc" "clobber")])
***************
*** 1424,1429 ****
--- 1430,1437 ----
     (set (pc) (if_then_else (lt (cc0) (const_int 0))
  			   (pc)
  			   (match_operand 1 "" "")))]
+ ;; ??? This is WRONG, dead_or_set_p cannot be used after reload
+ ;; because the REG_DEAD notes are not maintained after reload.
    "dead_or_set_p (ins1, operands[0]) && REG_OK_FOR_INDEX_P (operands[0])"
    "add %0,%0\;bcc %1"
    [(set_attr "cc" "clobber")])
*** ./gcc/config/pyr/pyr.md.~1~	Thu Jan 15 17:35:47 1998
--- ./gcc/config/pyr/pyr.md	Tue Jan 27 21:01:56 1998
***************
*** 1224,1229 ****
--- 1224,1231 ----
  	(sign_extend:SI (match_dup 1)))
     (set (cc0)
  	(match_dup 2))]
+ ;; ??? This is WRONG, dead_or_set_p cannot be used after reload
+ ;; because the REG_DEAD notes are not maintained after reload.
    "dead_or_set_p (insn, operands[2])"
    "*
    cc_status.flags |= CC_NO_OVERFLOW;
--------------



More information about the Gcc mailing list