Add an UNSPEC_PROLOGUE_USE to prevent the link register from being considered dead.

Add a testcase for the bug fixed by this patch.

From-SVN: r61509
This commit is contained in:
Nick Clifton 2003-01-20 18:59:43 +00:00 committed by Nick Clifton
parent 120cdf68d5
commit e32894124d
4 changed files with 41 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2003-01-20 Nick Clifton <nickc@redhat.com>
* config/arm/arm.md (sibcall_epilogue): Add an
UNSPEC_PROLOGUE_USE to prevent the link register from being
considered dead.
Mon Jan 20 14:36:23 CET 2003 Jan Hubicka <jh@suse.cz>
* i386.md (SSE cmov splitter): Handle memory operand in operand 5.

View File

@ -8430,8 +8430,14 @@
"
)
;; Note - although unspec_volatile's USE all hard registers,
;; USEs are ignored after relaod has completed. Thus we need
;; to add an unspec of the link register to ensure that flow
;; does not think that it is unused by the sibcall branch that
;; will replace the standard function epilogue.
(define_insn "sibcall_epilogue"
[(unspec_volatile [(const_int 0)] VUNSPEC_EPILOGUE)]
[(parallel [(unspec:SI [(reg:SI LR_REGNUM)] UNSPEC_PROLOGUE_USE)
(unspec_volatile [(return)] VUNSPEC_EPILOGUE)])]
"TARGET_ARM"
"*
if (USE_RETURN_INSN (FALSE))

View File

@ -1,3 +1,8 @@
2003-01-20 Nick Clifton <nickc@redhat.com>
* gcc.c-torture/execute/20030117-1.c: New test case. Exposes
problem with ARM sibcall code generation.
2003-01-20 Kazu Hirata <kazu@cs.umass.edu>
* gcc.c-torture/execute/20030120-1.c: New.

View File

@ -0,0 +1,23 @@
int foo (int, int, int);
int bar (int, int, int);
int main (void)
{
if (foo (5, 10, 21) != 12)
abort ();
if (bar (9, 12, 15) != 150)
abort ();
exit (0);
}
int foo (int x, int y, int z)
{
return (x + y + z) / 3;
}
int bar (int x, int y, int z)
{
return foo (x * x, y * y, z * z);
}