PATCH RFA: PR gcc/1532: jump to following instruction

Ian Lance Taylor ian@wasabisystems.com
Wed Feb 11 20:52:00 GMT 2004


Richard Henderson <rth@redhat.com> writes:

> On Tue, Feb 10, 2004 at 12:37:22PM -0500, Ian Lance Taylor wrote:
> > Your patch generates testsuite crashes just as my original patch did.
> > For example, this trivial function:
> >     int foo () { int i = 0; }
> > crashes at -O2 with
> >     foo1.c:1: internal compiler error: in verify_local_live_at_start,
> >     at flow.c:568
> 
> Ah right.  Perhaps better as 
> 
>   if (GET_CODE (XEXP (x, 0)) == REG
>       && (REGNO (XEXP (x, 0)) >= FIRST_PSEUDO_REGISTER
> 	  || reload_completed)
>       && ! REGNO_REG_SET_P (pbi->reg_live, REGNO (XEXP (x, 0))))
>     return true;
> 
> This should be the same as your patch, where we don't delete
> the CLOBBER unless there's something afterward that kills the
> register as well.

Thanks.  This patch solves the problem, and passes bootstrap and
testsuite on i686-pc-linux-gnu.

Should I check it in?

Ian


2004-02-11  Richard Henderson  <rth@redhat.com>

	* flow.c (insn_dead_p): A clobber of a dead hard register is a
	dead insn after reload.


Index: flow.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flow.c,v
retrieving revision 1.578
diff -p -u -r1.578 flow.c
--- flow.c	6 Feb 2004 19:29:56 -0000	1.578
+++ flow.c	11 Feb 2004 19:59:50 -0000
@@ -2267,14 +2267,22 @@ insn_dead_p (struct propagate_block_info
     }
 
   /* A CLOBBER of a pseudo-register that is dead serves no purpose.  That
-     is not necessarily true for hard registers.  */
-  else if (code == CLOBBER && GET_CODE (XEXP (x, 0)) == REG
-	   && REGNO (XEXP (x, 0)) >= FIRST_PSEUDO_REGISTER
-	   && ! REGNO_REG_SET_P (pbi->reg_live, REGNO (XEXP (x, 0))))
-    return 1;
+     is not necessarily true for hard registers until after reload.  */
+  else if (code == CLOBBER)
+    {
+      if (GET_CODE (XEXP (x, 0)) == REG
+	  && (REGNO (XEXP (x, 0)) >= FIRST_PSEUDO_REGISTER
+	      || reload_completed)
+	  && ! REGNO_REG_SET_P (pbi->reg_live, REGNO (XEXP (x, 0))))
+	return 1;
+    }
+
+  /* ??? A base USE is a historical relic.  It ought not be needed anymore.
+     Instances where it is still used are either (1) temporary and the USE
+     escaped the pass, (2) cruft and the USE need not be emitted anymore,
+     or (3) hiding bugs elsewhere that are not properly representing data
+     flow.  */
 
-  /* We do not check other CLOBBER or USE here.  An insn consisting of just
-     a CLOBBER or just a USE should not be deleted.  */
   return 0;
 }
 



More information about the Gcc-patches mailing list