aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2002-02-23 09:56:22 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2002-02-23 09:56:22 +0100
commit44c5edc005283d132f655130527e7eb08ededf51 (patch)
treed02d18445ae8ee79fe6e154f3e219c28254f8792 /gcc
parent31e2a00de52815757a9e59c4c807ecd7b625d0c8 (diff)
downloadgcc-44c5edc005283d132f655130527e7eb08ededf51.zip
gcc-44c5edc005283d132f655130527e7eb08ededf51.tar.gz
gcc-44c5edc005283d132f655130527e7eb08ededf51.tar.bz2
re PR rtl-optimization/5747 (ss20020218 fails to build binutils-2.11.93.0.2 on sparc-suse-linux - ICE in loop.c)
PR optimization/5747 * loop.c (scan_loop): Update reg info if move_movables created new pseudos. * gcc.dg/20020222-1.c: New test. From-SVN: r49989
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/loop.c20
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/20020222-1.c34
4 files changed, 63 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a4a547c..69c95cf 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2002-02-23 Jakub Jelinek <jakub@redhat.com>
+
+ PR optimization/5747
+ * loop.c (scan_loop): Update reg info if move_movables created new
+ pseudos.
+
2002-02-23 David Edelsohn <edelsohn@gnu.org>
* gcc.c (init_gcc_spec): Revert last change.
diff --git a/gcc/loop.c b/gcc/loop.c
index 68ef439..2bd1944 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -1102,7 +1102,25 @@ scan_loop (loop, flags)
optimizing for code size. */
if (! optimize_size)
- move_movables (loop, movables, threshold, insn_count);
+ {
+ move_movables (loop, movables, threshold, insn_count);
+
+ /* Recalculate regs->array if move_movables has created new
+ registers. */
+ if (max_reg_num () > regs->num)
+ {
+ loop_regs_scan (loop, 0);
+ for (update_start = loop_start;
+ PREV_INSN (update_start)
+ && GET_CODE (PREV_INSN (update_start)) != CODE_LABEL;
+ update_start = PREV_INSN (update_start))
+ ;
+ update_end = NEXT_INSN (loop_end);
+
+ reg_scan_update (update_start, update_end, loop_max_reg);
+ loop_max_reg = max_reg_num ();
+ }
+ }
/* Now candidates that still are negative are those not moved.
Change regs->array[I].set_in_loop to indicate that those are not actually
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e7149dd..15905e6 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2002-02-23 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.dg/20020222-1.c: New test.
+
2002-02-22 Jakub Jelinek <jakub@redhat.com>
* g++.dg/opt/anonunion1.C: New test.
diff --git a/gcc/testsuite/gcc.dg/20020222-1.c b/gcc/testsuite/gcc.dg/20020222-1.c
new file mode 100644
index 0000000..61f1054
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/20020222-1.c
@@ -0,0 +1,34 @@
+/* PR optimization/5747
+ This testcase ICEd on sparc because move_movables created new pseudos,
+ but did not update reg info which load_mems needed. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-options "-O2 -fPIC" { target sparc*-*-* } } */
+
+extern void foo (void);
+static char a[256];
+
+void
+bar (void)
+{
+ unsigned int i;
+ static int b = 0;
+ int c;
+
+ if (b == 0)
+ {
+ b = 1;
+ foo ();
+ c = 0;
+ for (i = 0; i < 10; i++)
+ a[i + '0'] = c++;
+ for (i = 'A'; i <= 'Z'; i++)
+ a[i] = c++;
+ a['$'] = c++;
+ a['%'] = c++;
+ a['.'] = c++;
+ a['_'] = c++;
+ for (i = 'a'; i <= 'z'; i++)
+ a[i] = c++;
+ }
+}