+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.
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
+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.
--- /dev/null
+/* 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++;
+ }
+}