Allow for AUTO_INC notes even before reload
Geoffrey Keating
geoffk@cygnus.com
Fri Nov 9 14:58:00 GMT 2001
We now call flow just _before_ reload too, and it seems that AUTO_INC
notes can be around then.
Tested on stormy16-elf and i686-linux-gnu.
--
Geoff Keating <geoffk@redhat.com>
===File ~/patches/gcc-stormy-deadautoinc.patch==============
2001-11-09 Geoffrey Keating <geoffk@redhat.com>
* flow.c (insn_dead_p): Allow for AUTO_INC notes all the time.
Index: testsuite/ChangeLog
2001-11-09 Geoffrey Keating <geoffk@redhat.com>
* gcc.c-torture/execute/20011109-2.c: New test.
Index: flow.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flow.c,v
retrieving revision 1.489
diff -p -u -p -r1.489 flow.c
--- flow.c 2001/10/29 11:45:44 1.489
+++ flow.c 2001/11/09 22:51:42
@@ -1892,21 +1892,18 @@ insn_dead_p (pbi, x, call_ok, notes)
enum rtx_code code = GET_CODE (x);
#ifdef AUTO_INC_DEC
- /* If flow is invoked after reload, we must take existing AUTO_INC
- expresions into account. */
- if (reload_completed)
+ /* As flow is invoked after combine, we must take existing AUTO_INC
+ expressions into account. */
+ for (; notes; notes = XEXP (notes, 1))
{
- for (; notes; notes = XEXP (notes, 1))
+ if (REG_NOTE_KIND (notes) == REG_INC)
{
- if (REG_NOTE_KIND (notes) == REG_INC)
- {
- int regno = REGNO (XEXP (notes, 0));
-
- /* Don't delete insns to set global regs. */
- if ((regno < FIRST_PSEUDO_REGISTER && global_regs[regno])
- || REGNO_REG_SET_P (pbi->reg_live, regno))
- return 0;
- }
+ int regno = REGNO (XEXP (notes, 0));
+
+ /* Don't delete insns to set global regs. */
+ if ((regno < FIRST_PSEUDO_REGISTER && global_regs[regno])
+ || REGNO_REG_SET_P (pbi->reg_live, regno))
+ return 0;
}
}
#endif
Index: testsuite/gcc.c-torture/execute/20011109-2.c
===================================================================
RCS file: 20011109-2.c
diff -N 20011109-2.c
--- /dev/null Tue May 5 13:32:27 1998
+++ 20011109-2.c Fri Nov 9 14:51:50 2001
@@ -0,0 +1,10 @@
+int main(void)
+{
+ char *c1 = "foo";
+ char *c2 = "foo";
+ int i;
+ for (i = 0; i < 3; i++)
+ if (c1[i] != c2[i])
+ abort ();
+ exit (0);
+}
============================================================
More information about the Gcc-patches
mailing list