public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* frv flow crash on direct returns
@ 2004-05-28 11:25 Alexandre Oliva
  2004-07-29 11:34 ` Aldy Hernandez
  0 siblings, 1 reply; 2+ messages in thread
From: Alexandre Oliva @ 2004-05-28 11:25 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 595 bytes --]

When tree-ssa was merged, frv-elf stopped building.  cmovh.c for
libgcc was what failed to build.  Here's a minimized testcase:

void f(int a, int b, int c) {
  if (a < b || a > b + 1)
    while (c)
      --c;
}

This crashed when flow for sched2 realized LR, that wasn't live
before, had become live because a direct return (that uses LR) was
inserted in postreload.

Richard Sandiford had already written a patch for what I believe to be
an earlier occurrence of this problem, back when he introduced
conditional returns.  Here's the patch.  I'm tempted to install it as
obvious, but...  Ok?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gcc-frv-epilogue-uses-lr.patch --]
[-- Type: text/x-patch, Size: 941 bytes --]

Index: gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	2003-11-19  Richard Sandiford <rsandifo@redhat.com>
	* config/frv/frv.h (EPILOGUE_USES): New.  Use LR.

Index: gcc/config/frv/frv.h
===================================================================
RCS file: /cvs/uberbaum/gcc/config/frv/frv.h,v
retrieving revision 1.47
diff -u -p -r1.47 frv.h
--- gcc/config/frv/frv.h 21 May 2004 01:03:17 -0000 1.47
+++ gcc/config/frv/frv.h 28 May 2004 06:52:49 -0000
@@ -959,6 +959,8 @@ extern int target_flags;
 #define EH_RETURN_STACKADJ_RTX	gen_rtx_REG (SImode, STACKADJ_REGNO)
 #define EH_RETURN_HANDLER_RTX   RETURN_ADDR_RTX (0, frame_pointer_rtx)
 
+#define EPILOGUE_USES(REGNO) ((REGNO) == LR_REGNO)
+
 /* An initializer that says which registers are used for fixed purposes all
    throughout the compiled code and are therefore not available for general
    allocation.  These would include the stack pointer, the frame pointer

[-- Attachment #3: Type: text/plain, Size: 188 bytes --]


-- 
Alexandre Oliva             http://www.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}

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

* Re: frv flow crash on direct returns
  2004-05-28 11:25 frv flow crash on direct returns Alexandre Oliva
@ 2004-07-29 11:34 ` Aldy Hernandez
  0 siblings, 0 replies; 2+ messages in thread
From: Aldy Hernandez @ 2004-07-29 11:34 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: gcc-patches

Richard approved this off-list.  I'm going to install it.

Thanks guys.

 > When tree-ssa was merged, frv-elf stopped building.  cmovh.c for
 > libgcc was what failed to build.  Here's a minimized testcase:

 > void f(int a, int b, int c) {
 >   if (a < b || a > b + 1)
 >     while (c)
 >       --c;
 > }

 > This crashed when flow for sched2 realized LR, that wasn't live
 > before, had become live because a direct return (that uses LR) was
 > inserted in postreload.

 > Richard Sandiford had already written a patch for what I believe to be
 > an earlier occurrence of this problem, back when he introduced
 > conditional returns.  Here's the patch.  I'm tempted to install it as
 > obvious, but...  Ok?

 > Index: gcc/ChangeLog
 > from  Alexandre Oliva  <aoliva@redhat.com>

 > 	2003-11-19  Richard Sandiford <rsandifo@redhat.com>
 > 	* config/frv/frv.h (EPILOGUE_USES): New.  Use LR.

 > Index: gcc/config/frv/frv.h
 > ===================================================================
 > RCS file: /cvs/uberbaum/gcc/config/frv/frv.h,v
 > retrieving revision 1.47
 > diff -u -p -r1.47 frv.h
 > --- gcc/config/frv/frv.h 21 May 2004 01:03:17 -0000 1.47
 > +++ gcc/config/frv/frv.h 28 May 2004 06:52:49 -0000
 > @@ -959,6 +959,8 @@ extern int target_flags;
 >  #define EH_RETURN_STACKADJ_RTX	gen_rtx_REG (SImode, STACKADJ_REGNO)
 >  #define EH_RETURN_HANDLER_RTX   RETURN_ADDR_RTX (0, frame_pointer_rtx)
 
 > +#define EPILOGUE_USES(REGNO) ((REGNO) == LR_REGNO)
 > +
 >  /* An initializer that says which registers are used for fixed purposes all
 >     throughout the compiled code and are therefore not available for general
 >     allocation.  These would include the stack pointer, the frame pointer

 > -- 
 > Alexandre Oliva             http://www.ic.unicamp.br/~oliva/
 > Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
 > Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}

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

end of thread, other threads:[~2004-07-28 21:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-28 11:25 frv flow crash on direct returns Alexandre Oliva
2004-07-29 11:34 ` Aldy Hernandez

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