OSDN Git Service

* flow.c (insn_dead_p): Allow for AUTO_INC notes all the time.
authorgeoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 9 Nov 2001 23:06:04 +0000 (23:06 +0000)
committergeoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 9 Nov 2001 23:06:04 +0000 (23:06 +0000)
In testsuite/:

* gcc.c-torture/execute/20011109-2.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46901 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/flow.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/20011109-2.c [new file with mode: 0644]

index 0632c7b..8e7d9e7 100644 (file)
@@ -1,5 +1,7 @@
 2001-11-09  Geoffrey Keating  <geoffk@redhat.com>
 
+       * flow.c (insn_dead_p): Allow for AUTO_INC notes all the time.
+
        * config/stormy16/stormy16.h (ASM_SPEC): Revert last change,
        don't pass --gdwarf2 to the assembler if the compiler will also
        provide debug info.
index 50e7494..fbe570b 100644 (file)
@@ -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 1b598d7..7fa8c9e 100644 (file)
@@ -1,5 +1,7 @@
 2001-11-09  Geoffrey Keating  <geoffk@redhat.com>
 
+       * gcc.c-torture/execute/20011109-2.c: New test.
+
        * gcc.c-torture/execute/20011109-1.c: New test.
 
 2001-11-09  Jakub Jelinek  <jakub@redhat.com>
diff --git a/gcc/testsuite/gcc.c-torture/execute/20011109-2.c b/gcc/testsuite/gcc.c-torture/execute/20011109-2.c
new file mode 100644 (file)
index 0000000..1abbbf2
--- /dev/null
@@ -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);
+}