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]

Re: [PATCH] Fix ICE with delayed-branch targets after epilogue-unwind patch


On Mon, Jun 15, 2009 at 05:09:56PM +0200, Jakub Jelinek wrote:
> On Mon, Jun 08, 2009 at 09:03:10AM -0400, Richard Guenther wrote:
> > On Sat, Jun 6, 2009 at 1:41 PM, Adam Nemet<anemet@caviumnetworks.com> wrote:
> > > This fixes the new ICEs in:
> > >
> > > ?http://gcc.gnu.org/ml/gcc-testresults/2009-06/msg00327.html
> > >
> > > The gcc_assert in dwarf2out_begin_epilogue fires because returnjump_p fails to
> > > recognize a return inside a SEQUENCE.
> > >
> > > Bootstrapped and regtested on mips64octeon-linux.
> > >
> > > OK?
> > 
> > Ok.
> 
> I'm not convinced this is the right place to fix it.
> In most returnjump_p calls SEQUENCEs aren't present at all, and in the
> dwarf2out.c case we IMHO have to handle it in the caller anyway:
> 
> In
>       /* Look for both regular and sibcalls to end the block.  */
>       if (returnjump_p (i))
>         break;
>       if (CALL_P (i) && SIBLING_CALL_P (i))
>         break;
>   
>       if (RTX_FRAME_RELATED_P (i))
>         saw_frp = true;
> 
> not only the return jump can be inside of SEQUENCE, but so can
> be the sibling call and so could be RTX_FRAME_RELATED_P insns.

Here is an untested patch that fixed a sparc32 testcase that was ICEing
without it in a cross-compiler.  I don't have a setup ATM to
bootstrap/regtest this on sparc* nor any other DBR using target though.

2009-06-15  Jakub Jelinek  <jakub@redhat.com>

	* jump.c (returnjump_p): Revert last patch.
	* dwarf2out.c (dwarf2out_begin_epilogue): Handle SEQUENCEs.

--- gcc/jump.c.jj	2009-06-12 10:31:59.000000000 +0200
+++ gcc/jump.c	2009-06-15 17:28:56.000000000 +0200
@@ -891,13 +891,8 @@ returnjump_p_1 (rtx *loc, void *data ATT
 int
 returnjump_p (rtx insn)
 {
-  /* Handle delayed branches.  */
-  if (NONJUMP_INSN_P (insn) && GET_CODE (PATTERN (insn)) == SEQUENCE)
-    insn = XVECEXP (PATTERN (insn), 0, 0);
-
   if (!JUMP_P (insn))
     return 0;
-
   return for_each_rtx (&PATTERN (insn), returnjump_p_1, NULL);
 }
 
--- gcc/dwarf2out.c.jj	2009-06-12 11:31:38.000000000 +0200
+++ gcc/dwarf2out.c	2009-06-15 17:27:57.000000000 +0200
@@ -2746,6 +2746,22 @@ dwarf2out_begin_epilogue (rtx insn)
       if (CALL_P (i) && SIBLING_CALL_P (i))
 	break;
 
+      if (GET_CODE (PATTERN (i)) == SEQUENCE)
+	{
+	  int idx;
+	  rtx seq = PATTERN (i);
+
+	  if (returnjump_p (XVECEXP (seq, 0, 0)))
+	    break;
+	  if (CALL_P (XVECEXP (seq, 0, 0))
+	      && SIBLING_CALL_P (XVECEXP (seq, 0, 0)))
+	    break;
+
+	  for (idx = 0; idx < XVECLEN (seq, 0); idx++)
+	    if (RTX_FRAME_RELATED_P (XVECEXP (seq, 0, idx)))
+	      saw_frp = true;
+	}
+
       if (RTX_FRAME_RELATED_P (i))
 	saw_frp = true;
     }


	Jakub


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