public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: scheduling problems again
  1998-01-28  0:50 scheduling problems again Mike Stump
@ 1998-01-27 23:03 ` Jeffrey A Law
  1998-01-28 15:03   ` amylaar
  0 siblings, 1 reply; 13+ messages in thread
From: Jeffrey A Law @ 1998-01-27 23:03 UTC (permalink / raw)
  To: Mike Stump; +Cc: egcs

  In message < 199801280659.WAA08326@kankakee.wrs.com >you write:
  > > Though we really should fix dead_or_set_p.
  > 
  > Yes, that would be good.  I thought about submitting a patch for it,
  > but I would rather the person like yourself that can field questions
  > be listed on the changelog entry, also, I wasn't sure if:
  > 
  >    if (reload_in_progress || reload_completed)
  >     abort ();
  > 
  > at the top of dead_or_set_regno_p would cause problems.  Maybe just
  > 
  >    if (reload_completed)
  >     abort ();
  > 
  > would be right?
No.  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.

jeff

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: scheduling problems again
@ 1998-01-28  0:50 Mike Stump
  1998-01-27 23:03 ` Jeffrey A Law
  0 siblings, 1 reply; 13+ messages in thread
From: Mike Stump @ 1998-01-28  0:50 UTC (permalink / raw)
  To: law; +Cc: egcs

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

> they can't go in output routines (since that happens after reload).

Ah, thanks.

> This patch doesn't catch them all, but it does note all the ones in 
> peepholes, which is as good a start as any...

Add in the below, and we'll have even more of them (all of them).  I
checked the .[ch] files and didn't get any hits, so we should have
them all.

> Though we really should fix dead_or_set_p.

Yes, that would be good.  I thought about submitting a patch for it,
but I would rather the person like yourself that can field questions
be listed on the changelog entry, also, I wasn't sure if:

   if (reload_in_progress || reload_completed)
    abort ();

at the top of dead_or_set_regno_p would cause problems.  Maybe just

   if (reload_completed)
    abort ();

would be right?

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);
--------------

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: scheduling problems again
  1998-01-27 23:03 ` Jeffrey A Law
@ 1998-01-28 15:03   ` amylaar
  0 siblings, 0 replies; 13+ messages in thread
From: amylaar @ 1998-01-28 15:03 UTC (permalink / raw)
  To: Jeffrey A Law; +Cc: egcs

> No.  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.

Actually, REG_DEAD notes still have some meaning after reload:  they mean
that the register dies somewhere in the current basic block.
Thus, when this is good enough, the current definition of dead_or_set_p
is useful.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: scheduling problems again
@ 1998-01-29 14:41 Mike Stump
  0 siblings, 0 replies; 13+ messages in thread
From: Mike Stump @ 1998-01-29 14:41 UTC (permalink / raw)
  To: amylaar; +Cc: egcs

> From: amylaar@cygnus.co.uk
> To: law@cygnus.com (Jeffrey A Law)
> Date: Wed, 28 Jan 1998 16:34:44 +0000 (GMT)
> Cc: egcs@cygnus.com

> Actually, REG_DEAD notes still have some meaning after reload: they
> mean that the register dies somewhere in the current basic block.
> Thus, when this is good enough, the current definition of
> dead_or_set_p is useful.

If that is the case, sounds like we should have a new function like
dead_or_set_in_bblock_p in addition to dead_or_set_p.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: scheduling problems again
  1998-01-28 15:03 Mike Stump
@ 1998-01-28 19:24 ` Jeffrey A Law
  0 siblings, 0 replies; 13+ messages in thread
From: Jeffrey A Law @ 1998-01-28 19:24 UTC (permalink / raw)
  To: Mike Stump; +Cc: egcs

  In message < 199801281855.KAA22510@kankakee.wrs.com >you write:

  > 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.
  > 	* genattrtab.c (reload_completed): Define so that if
  > 	dead_or_set_p is ever called, REG_DEAD notes are treated as
  > 	valid.
Thanks.  I've installed your patch.

jeff



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: scheduling problems again
  1998-01-28 15:03   ` Marc Lehmann
@ 1998-01-28 19:24     ` Jeffrey A Law
  0 siblings, 0 replies; 13+ messages in thread
From: Jeffrey A Law @ 1998-01-28 19:24 UTC (permalink / raw)
  To: Marc Lehmann; +Cc: egcs

  In message < 19980128231608.42139@cerebro.laendle >you write:
  > Well, but the transformation jump wanted to do was not only legal
  > but code-improving.. having correct death notes would improve
  > the code.
Yup.  There's a variety of places where having this information
would allow the compiler to generate better code.  This may fall
out of the splitting work since it requires 100% accurate information
about what's dead and what's live at any given instruction.

  > anyway, if you can't rely on deathnotes, you shouldn't be using
  > jump_optimize anyway, since most of it's work (removing
  > conditional jumps) requires death notes.
Huh?  jump does lots of other stuff other than just removing
conditional jumps....

jeff

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: scheduling problems again
@ 1998-01-28 15:03 Mike Stump
  1998-01-28 19:24 ` Jeffrey A Law
  0 siblings, 1 reply; 13+ messages in thread
From: Mike Stump @ 1998-01-28 15:03 UTC (permalink / raw)
  To: law; +Cc: egcs

> 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.

Oops, my last patch was incomplete and not as optimal as it could be,
try this instead:

The genattrtab.c patch is so that genattrtab can link.  It doesn't
actually use dead_or_set_p currently (I checked), but if in the future
it does, the semantics will be that the REG_DEAD notes (if any are
found) are reliable.  That seemed like a reasonable default.

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.
	* genattrtab.c (reload_completed): Define so that if
	dead_or_set_p is ever called, REG_DEAD notes are treated as
	valid.

Doing diffs in genattrtab.c.~1~:
*** genattrtab.c.~1~	Mon Jan 19 12:21:17 1998
--- genattrtab.c	Wed Jan 28 10:32:33 1998
*************** static rtx true_rtx, false_rtx;
*** 348,353 ****
--- 348,358 ----
  
  static char *alternative_name;
  
+ /* Indicate that REG_DEAD notes are valid if dead_or_set_p is ever
+    called.  */
+ 
+ int reload_completed = 0;
+ 
  /* Simplify an expression.  Only call the routine if there is something to
     simplify.  */
  #define SIMPLIFY_TEST_EXP(EXP,INSN_CODE,INSN_INDEX)	\
--------------
Doing diffs in rtlanal.c.~1~:
*** rtlanal.c.~1~	Thu Jan 15 17:20:49 1998
--- rtlanal.c	Wed Jan 28 10:23:32 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,1186 ----
    int regno, endregno;
    rtx link;
  
!   /* REG_READ notes are not normally maintained after reload, so we
!      ignore them if the are invalid.  */
!   if (! reload_completed
! #ifdef PRESERVE_DEATH_INFO_REGNO_P
!       || PRESERVE_DEATH_INFO_REGNO_P (test_regno)
! #endif
!       )
      {
!       /* 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
--------------

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: scheduling problems again
  1998-01-27 20:17 ` Jeffrey A Law
@ 1998-01-28 15:03   ` Marc Lehmann
  1998-01-28 19:24     ` Jeffrey A Law
  0 siblings, 1 reply; 13+ messages in thread
From: Marc Lehmann @ 1998-01-28 15:03 UTC (permalink / raw)
  To: egcs

On Tue, Jan 27, 1998 at 09:18:59PM -0700, Jeffrey A Law wrote:
> 
>   In message < 19980128023544.16763@cerebro.laendle >you write:
>   > The point is that the REG_DEAD notes are not updated after reload with
>   > either the haifa scheduler (which was used here), nor with the normal
>   > scheduler.
> Other post-reload passes also do not keep accurate REG_DEAD notes.
> 
> Depending on them after reload is plain wrong.  This is a bug in jump.c
> plain and simple.

Well, but the transformation jump wanted to do was not only legal
but code-improving.. having correct death notes would improve
the code.

anyway, if you can't rely on deathnotes, you shouldn't be using
jump_optimize anyway, since most of it's work (removing
conditional jumps) requires death notes.

      -----==-                                              |
      ----==-- _                                            |
      ---==---(_)__  __ ____  __       Marc Lehmann       +--
      --==---/ / _ \/ // /\ \/ /       pcg@goof.com       |e|
      -=====/_/_//_/\_,_/ /_/\_\                          --+
    The choice of a GNU generation                        |
                                                          |

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: scheduling problems again
@ 1998-01-28 14:54 Mike Stump
  0 siblings, 0 replies; 13+ messages in thread
From: Mike Stump @ 1998-01-28 14:54 UTC (permalink / raw)
  To: law; +Cc: egcs

> 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;
--------------

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: scheduling problems again
  1998-01-27 21:10 Mike Stump
@ 1998-01-27 22:03 ` Jeffrey A Law
  0 siblings, 0 replies; 13+ messages in thread
From: Jeffrey A Law @ 1998-01-27 22:03 UTC (permalink / raw)
  To: Mike Stump; +Cc: egcs

  In message < 199801280510.VAA12134@kankakee.wrs.com >you write:
  > I'm not sure if I understand exactly where they can't go, but my guess
  > is you meant the below cases.  If I guessed right, can you put this
  > in, so that the people that stare at the machine ports in question,
  > can stare at the bogosity of the port as well.  The first step in
  > fixing a problem is identifying it.
They can't go in a peephole (since peepholes are performed after reload),
they can't go in output routines (since that happens after reload).

This patch doesn't catch them all, but it does note all the ones in 
peepholes, which is as good a start as any...

Though we really should fix dead_or_set_p.

jeff

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: scheduling problems again
@ 1998-01-27 21:10 Mike Stump
  1998-01-27 22:03 ` Jeffrey A Law
  0 siblings, 1 reply; 13+ messages in thread
From: Mike Stump @ 1998-01-27 21:10 UTC (permalink / raw)
  To: law; +Cc: egcs

> To: Marc Lehmann <pcg@goof.com>
> cc: egcs@cygnus.com
> Date: Tue, 27 Jan 1998 21:18:59 -0700
> From: Jeffrey A Law <law@cygnus.com>

> Depending on them after reload is plain wrong.  This is a bug in
> jump.c plain and simple.  Some ports also have this bug in peepholes
> because they use dead_or_set_p.

I'm not sure if I understand exactly where they can't go, but my guess
is you meant the below cases.  If I guessed right, can you put this
in, so that the people that stare at the machine ports in question,
can stare at the bogosity of the port as well.  The first step in
fixing a problem is identifying it.

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;
--------------


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: scheduling problems again
  1998-01-27 19:19 Marc Lehmann
@ 1998-01-27 20:17 ` Jeffrey A Law
  1998-01-28 15:03   ` Marc Lehmann
  0 siblings, 1 reply; 13+ messages in thread
From: Jeffrey A Law @ 1998-01-27 20:17 UTC (permalink / raw)
  To: Marc Lehmann; +Cc: egcs

  In message < 19980128023544.16763@cerebro.laendle >you write:
  > The point is that the REG_DEAD notes are not updated after reload with
  > either the haifa scheduler (which was used here), nor with the normal
  > scheduler.
Other post-reload passes also do not keep accurate REG_DEAD notes.

Depending on them after reload is plain wrong.  This is a bug in jump.c
plain and simple.  Some ports also have this bug in peepholes because
they use dead_or_set_p.

jeff

^ permalink raw reply	[flat|nested] 13+ messages in thread

* scheduling problems again
@ 1998-01-27 19:19 Marc Lehmann
  1998-01-27 20:17 ` Jeffrey A Law
  0 siblings, 1 reply; 13+ messages in thread
From: Marc Lehmann @ 1998-01-27 19:19 UTC (permalink / raw)
  To: egcs

I once again debugged a problem (in pgcc), and found out what
I think is a bug in egcs ;)

Before scheduling (after reload):
(insn:QI 1275 2208 1277 (set (reg/v:SI 3 %ebx)
        (mem/s:SI (plus:SI (reg:SI 1 %edx)
                (const_int 48)))) 57 {movsi+2} (nil)
    (nil))                                          

(insn:QI 1277 1275 1279 (set (reg:SI 7 %esp)
        (plus:SI (reg:SI 7 %esp)
            (const_int 16))) 148 {addsi3+1} (nil)   
    (nil))

(note 1279 1277 2211 "" NOTE_INSN_DELETED)

(insn 2211 1279 2383 (set (reg:SI 2 %ecx) 
        (reg:SI 1 %edx)) 57 {movsi+2} (nil)
    (expr_list:REG_DEAD (reg:SI 1 %edx)
        (nil)))

After scheduling:
(insn 2211 2205 1275 (set (reg:SI 2 %ecx)
        (reg:SI 1 %edx)) 57 {movsi+2} (insn_list 2208 (insn_list:REG_DEP_ANTI 1268 (nil)))
    (expr_list:REG_DEAD (reg:SI 1 %edx)
        (nil)))

(insn:QI 1275 2211 1277 (set (reg/v:SI 3 %ebx)
        (mem/s:SI (plus:SI (reg:SI 1 %edx)    
                (const_int 48)))) 57 {movsi+2} (insn_list 2208 (insn_list:REG_DEP_ANTI 1268 (insn_list 1270 (i
    (nil))


The point is that the REG_DEAD notes are not updated after reload with
either the haifa scheduler (which was used here), nor with the normal scheduler.

Effect is that jump optimization (which _depends_ on correct death notes!)
sometimes removes too many instructions (in delete_computation).

I don't have a testcase (i.e. only for pgcc), but I reported the same
problem with the old scheduler some months ago to the gcc2 list, and apart
from a "well, this issue has to be resolved", I didn't receive feedback
(and the problem persists).

Or am I wrong? scheduling doesn't update death notes if after_reload==1,
but jump_optimize uses death notes for instruction removal.

      -----==-                                              |
      ----==-- _                                            |
      ---==---(_)__  __ ____  __       Marc Lehmann       +--
      --==---/ / _ \/ // /\ \/ /       pcg@goof.com       |e|
      -=====/_/_//_/\_,_/ /_/\_\                          --+
    The choice of a GNU generation                        |
                                                          |

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~1998-01-29 14:41 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-01-28  0:50 scheduling problems again Mike Stump
1998-01-27 23:03 ` Jeffrey A Law
1998-01-28 15:03   ` amylaar
  -- strict thread matches above, loose matches on Subject: below --
1998-01-29 14:41 Mike Stump
1998-01-28 15:03 Mike Stump
1998-01-28 19:24 ` Jeffrey A Law
1998-01-28 14:54 Mike Stump
1998-01-27 21:10 Mike Stump
1998-01-27 22:03 ` Jeffrey A Law
1998-01-27 19:19 Marc Lehmann
1998-01-27 20:17 ` Jeffrey A Law
1998-01-28 15:03   ` Marc Lehmann
1998-01-28 19:24     ` Jeffrey A Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).