]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR rtl-optimization/13521 ([3.3 only] Endless loop in calculate_global_regs_live)
authorJakub Jelinek <jakub@redhat.com>
Thu, 1 Jan 2004 13:19:41 +0000 (14:19 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 1 Jan 2004 13:19:41 +0000 (14:19 +0100)
PR optimization/13521
Backport from mainline:
2003-03-22  Richard Henderson <rth@redhat.com>

* cfgcleanup.c (insns_match_p): Do not do EQUIV substitution
after reload.

* gcc.c-torture/compile/20031231-1.c: New test.

From-SVN: r75300

gcc/ChangeLog
gcc/cfgcleanup.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20031231-1.c [new file with mode: 0644]

index e569f4d122c837787d571bc3f260cf5fabc76a54..74d16a6c9ea56877e438af39bdc4492f20c18aa3 100644 (file)
@@ -1,3 +1,12 @@
+2004-01-01  Jakub Jelinek  <jakub@redhat.com>
+
+       PR optimization/13521
+       Backport from mainline:
+               2003-03-22  Richard Henderson <rth@redhat.com>
+
+               * cfgcleanup.c (insns_match_p): Do not do EQUIV substitution
+               after reload.
+
 2003-12-31  Roger Sayle  <roger@eyesopen.com>
 
        PR fortran/12632
index df914ec0cf27c66e9b753bafb0e4ba432bf1beca..aa120bd4bec2e2cc8262d668e200fd8bc9ee46d3 100644 (file)
@@ -974,7 +974,15 @@ insns_match_p (mode, i1, i2)
 #endif
 
   if (reload_completed
-      ? ! rtx_renumbered_equal_p (p1, p2) : ! rtx_equal_p (p1, p2))
+      ? rtx_renumbered_equal_p (p1, p2) : rtx_equal_p (p1, p2))
+    return true;
+
+  /* Do not do EQUIV substitution after reload.  First, we're undoing the
+     work of reload_cse.  Second, we may be undoing the work of the post-
+     reload splitting pass.  */
+  /* ??? Possibly add a new phase switch variable that can be used by
+     targets to disallow the troublesome insns after splitting.  */
+  if (!reload_completed)
     {
       /* The following code helps take care of G++ cleanups.  */
       rtx equiv1 = find_reg_equal_equiv_note (i1);
@@ -1001,11 +1009,9 @@ insns_match_p (mode, i1, i2)
                return true;
            }
        }
-
-      return false;
     }
 
-  return true;
+  return false;
 }
 \f
 /* Look through the insns at the end of BB1 and BB2 and find the longest
index 3b58c492f1d9a15be241a7b21980971bbb7d14ad..e34dc4a4ca441b7afb5201e4e11d6f2c1306d65f 100644 (file)
@@ -1,3 +1,8 @@
+2004-01-01  Jakub Jelinek  <jakub@redhat.com>
+
+       PR optimization/13521
+       * gcc.c-torture/compile/20031231-1.c: New test.
+
 2003-12-31  Roger Sayle  <roger@eyesopen.com>
 
        PR fortran/12632
diff --git a/gcc/testsuite/gcc.c-torture/compile/20031231-1.c b/gcc/testsuite/gcc.c-torture/compile/20031231-1.c
new file mode 100644 (file)
index 0000000..bbd8e7c
--- /dev/null
@@ -0,0 +1,51 @@
+extern int f1 (int, void *);
+extern int *f2 (void) __attribute__ ((__const__));
+extern int f3 (int, void *);
+
+int
+test (int x, char *y, int z)
+{
+  int b = 0;
+
+  if (x < 1024)
+    {
+      y[0] = '\0';
+
+      do
+       {
+         switch (f1 (x, y + b))
+           {
+           case -1:
+             if (b == 0)
+               return -1;
+             else
+               return b;
+
+           default:
+             b++;
+           }
+       }
+      while (y[b - 1] != '\0' && y[b - 1] != '\n' && b < z);
+    }
+  else
+    {
+      do
+       {
+         switch (f3 (x, y + b))
+           {
+           case -1:
+             if ((*f2 ()) == 4)
+               continue;
+             if (b == 0)
+               return -1;
+             else
+               return b;
+
+           default:
+             b++;
+           }
+       }
+      while (y[b - 1] != '\0' && y[b - 1] != '\n' && b < z);
+    }
+  return b;
+}