This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH]: Fix PR c/12372
> Then I can propose the following patch to propagate_one_insn.
Bootstrapped/regtested on sparc64-sun-solaris2.9 and sparc-sun-solaris2.8
(mainline, except Ada). It fixes the failures both on SPARC and HP-PA.
Ok for mainline?
2003-10-29 Eric Botcazou <ebotcazou@libertysurf.fr>
John David Anglin <dave@hiauly1.hia.nrc.ca>
PR optimization/12372
* flow.c (propagate_one_insn) [CALL_INSN]: Initialize
sibcall_p on block entry. Invalidate MEMs related to the
frame pointer for const or pure sibcalls.
--
Eric Botcazou
Index: flow.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flow.c,v
retrieving revision 1.563
diff -u -p -r1.563 flow.c
--- flow.c 17 Oct 2003 10:30:43 -0000 1.563
+++ flow.c 24 Oct 2003 17:18:12 -0000
@@ -1726,7 +1726,7 @@ propagate_one_insn (struct propagate_blo
if (GET_CODE (insn) == CALL_INSN)
{
regset live_at_end;
- bool sibcall_p;
+ bool sibcall_p = SIBLING_CALL_P (insn);
rtx note, cond;
int i;
@@ -1736,14 +1736,19 @@ propagate_one_insn (struct propagate_blo
/* Non-constant calls clobber memory, constant calls do not
clobber memory, though they may clobber outgoing arguments
- on the stack. */
+ on the stack (or in the frame for sibcalls). */
if (! CONST_OR_PURE_CALL_P (insn))
{
free_EXPR_LIST_list (&pbi->mem_set_list);
pbi->mem_set_list_len = 0;
}
else
- invalidate_mems_from_set (pbi, stack_pointer_rtx);
+ {
+ if (sibcall_p)
+ invalidate_mems_from_set (pbi, frame_pointer_rtx);
+ else
+ invalidate_mems_from_set (pbi, stack_pointer_rtx);
+ }
/* There may be extra registers to be clobbered. */
for (note = CALL_INSN_FUNCTION_USAGE (insn);
@@ -1757,7 +1762,6 @@ propagate_one_insn (struct propagate_blo
clobber anything that must be preserved at end-of-function,
except for return values. */
- sibcall_p = SIBLING_CALL_P (insn);
live_at_end = EXIT_BLOCK_PTR->global_live_at_start;
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
if (TEST_HARD_REG_BIT (regs_invalidated_by_call, i)