From: Falk Hueffner Date: Sat, 27 Nov 2004 16:59:16 +0000 (+0100) Subject: re PR rtl-optimization/18577 (variable use moved before initialization) X-Git-Tag: releases/gcc-3.3.6~220 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=996e40f613e39df0e8bc4230aaa3357247121cf1;p=thirdparty%2Fgcc.git re PR rtl-optimization/18577 (variable use moved before initialization) PR optimization/18577 * unroll.c (unroll_loop): Test both REGNO_LAST_UID and REGNO_LAST_NOTE_UID to decide whether a pseudo is local to the loop. Co-Authored-By: Eric Botcazou From-SVN: r91383 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bbfd8f5efcd5..8882add1203b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2004-11-27 Falk Hueffner + Eric Botcazou + + PR optimization/18577 + * unroll.c (unroll_loop): Test both REGNO_LAST_UID and + REGNO_LAST_NOTE_UID to decide whether a pseudo is local + to the loop. + 2004-11-27 Alan Modra PR target/12769 diff --git a/gcc/regclass.c b/gcc/regclass.c index 45c69d8b89a1..ecc630f42da3 100644 --- a/gcc/regclass.c +++ b/gcc/regclass.c @@ -2415,9 +2415,15 @@ reg_scan_mark_refs (x, insn, note_flag, min_regno) if (regno >= min_regno) { + /* While the following 3 lines means that the inequality + REGNO_LAST_UID (regno) <= REGNO_LAST_NOTE_UID (regno) + is true at the end of the scanning, it may be subsequently + invalidated (e.g. in load_mems) so it should not be relied + upon. */ REGNO_LAST_NOTE_UID (regno) = INSN_UID (insn); if (!note_flag) REGNO_LAST_UID (regno) = INSN_UID (insn); + if (REGNO_FIRST_UID (regno) == 0) REGNO_FIRST_UID (regno) = INSN_UID (insn); /* If we are called by reg_scan_update() (indicated by min_regno diff --git a/gcc/regs.h b/gcc/regs.h index 2e838e329398..e823298614de 100644 --- a/gcc/regs.h +++ b/gcc/regs.h @@ -49,6 +49,9 @@ typedef struct reg_info_def int first_uid; /* UID of first insn to use (REG n) */ int last_uid; /* UID of last insn to use (REG n) */ int last_note_uid; /* UID of last note to use (REG n) */ + /* See the comment in reg_scan_mark_refs on + the relationship between last_uid and + last_note_uid. */ /* fields set by reg_scan & flow_analysis */ int sets; /* # of times (REG n) is set */ diff --git a/gcc/unroll.c b/gcc/unroll.c index a81420809180..8498874df41b 100644 --- a/gcc/unroll.c +++ b/gcc/unroll.c @@ -794,6 +794,10 @@ unroll_loop (loop, insn_count, strength_reduce_p) for (r = FIRST_PSEUDO_REGISTER; r < max_reg_before_loop; ++r) if (REGNO_FIRST_UID (r) > 0 && REGNO_FIRST_UID (r) < max_uid_for_loop && REGNO_FIRST_LUID (r) >= copy_start_luid + /* See the comment in reg_scan_mark_refs on the relationship between + last_uid and last_note_uid. */ + && REGNO_LAST_UID (r) > 0 && REGNO_LAST_UID (r) < max_uid_for_loop + && REGNO_LAST_LUID (r) <= copy_end_luid && REGNO_LAST_NOTE_UID (r) > 0 && REGNO_LAST_NOTE_UID (r) < max_uid_for_loop && REGNO_LAST_NOTE_LUID (r) <= copy_end_luid) {