johannes 02/08/14 14:50:44
Modified: gcc reload1.c explow.c
Log:
Fix for 2999600. This is also in FSF sources.
Revision Changes Path
1.20 +7 -3 gcc3/gcc/reload1.c
Index: reload1.c
===================================================================
RCS file: /cvs/Darwin/gcc3/gcc/reload1.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- reload1.c 2002/08/02 10:05:30 1.19
+++ reload1.c 2002/08/14 21:50:43 1.20
@@ -1181,9 +1181,11 @@
/* Make a pass over all the insns and delete all USEs which we inserted
only to tag a REG_EQUAL note on them. Remove all REG_DEAD and REG_UNUSED
notes. Delete all CLOBBER insns that don't refer to the return value
- and simplify (subreg (reg)) operands. Also remove all REG_RETVAL and
- REG_LIBCALL notes since they are no longer useful or accurate. Strip
- and regenerate REG_INC notes that may have been moved around. */
+ or to memory (mem:BLK CLOBBERs must be kept around to prevent the scheduler
+ from misarranging variable-array code) and simplify (subreg (reg))
+ operands. Also remove all REG_RETVAL and REG_LIBCALL notes since
+ they are no longer useful or accurate. Strip and regenerate REG_INC
+ notes that may have been moved around. */
for (insn = first; insn; insn = NEXT_INSN (insn))
if (INSN_P (insn))
@@ -1200,6 +1202,8 @@
&& (GET_MODE (insn) == QImode
|| find_reg_note (insn, REG_EQUAL, NULL_RTX)))
|| (GET_CODE (PATTERN (insn)) == CLOBBER
+ && (GET_CODE (XEXP (PATTERN (insn), 0)) != MEM
+ || GET_MODE (XEXP (PATTERN (insn), 0)) != BLKmode)
&& (GET_CODE (XEXP (PATTERN (insn), 0)) != REG
|| ! REG_FUNCTION_VALUE_P (XEXP (PATTERN (insn), 0)))))
{
1.12 +8 -1 gcc3/gcc/explow.c
Index: explow.c
===================================================================
RCS file: /cvs/Darwin/gcc3/gcc/explow.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- explow.c 2002/08/02 10:05:15 1.11
+++ explow.c 2002/08/14 21:50:44 1.12
@@ -1065,7 +1065,14 @@
}
if (sa != 0)
- sa = validize_mem (sa);
+ {
+ sa = validize_mem (sa);
+ /* This clobber prevents the scheduler from moving
+ references to variable arrays below the code
+ that deletes (pops) the arrays. */
+ emit_insn (gen_rtx_CLOBBER (VOIDmode,
+ gen_rtx_MEM (BLKmode, stack_pointer_rtx)));
+ }
if (after)
{