From: Jakub Jelinek Date: Sat, 23 Feb 2002 08:56:22 +0000 (+0100) Subject: re PR rtl-optimization/5747 (ss20020218 fails to build binutils-2.11.93.0.2 on sparc... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=44c5edc005283d132f655130527e7eb08ededf51;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a4a547c8b3d..69c95cf5e5e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2002-02-23 Jakub Jelinek + + PR optimization/5747 + * loop.c (scan_loop): Update reg info if move_movables created new + pseudos. + 2002-02-23 David Edelsohn * gcc.c (init_gcc_spec): Revert last change. diff --git a/gcc/loop.c b/gcc/loop.c index 68ef43906cb..2bd19445ae0 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 e7149dd6a2c..15905e6ea5b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2002-02-23 Jakub Jelinek + + * gcc.dg/20020222-1.c: New test. + 2002-02-22 Jakub Jelinek * 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 00000000000..61f10540f2a --- /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++; + } +}