From: Bernd Schmidt Date: Thu, 30 Nov 2000 14:16:55 +0000 (+0000) Subject: Backport a change to the 2.95 branch X-Git-Tag: prereleases/gcc-2.95.3-test1~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8c23b3a9e263627b52d7b9d6d7aa5c1eb049195;p=thirdparty%2Fgcc.git Backport a change to the 2.95 branch From-SVN: r37892 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 96efcf396431..2e140caed00c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2000-11-30 Bernd Schmidt + Based on a patch from Geoff Keating : + * loop.c (basic_induction_var): If a REG is set from something + that is not a biv, then the REG is not a biv. Even if it is + earlier set from something that is a biv. + 2000-09-01 Jim Wilson * loop.c (check_final_value): Check for biv use before checking for giv use. Check for both biv and giv uses. Always set last_giv_use diff --git a/gcc/loop.c b/gcc/loop.c index 3991a71fdb8b..1aa56b75029a 100644 --- a/gcc/loop.c +++ b/gcc/loop.c @@ -6007,6 +6007,7 @@ basic_induction_var (x, mode, dest_reg, p, inc_val, mult_val, location) insn = p; while (1) { + rtx dest; do { insn = PREV_INSN (insn); } while (insn && GET_CODE (insn) == NOTE @@ -6018,20 +6019,26 @@ basic_induction_var (x, mode, dest_reg, p, inc_val, mult_val, location) if (set == 0) break; - if ((SET_DEST (set) == x - || (GET_CODE (SET_DEST (set)) == SUBREG - && (GET_MODE_SIZE (GET_MODE (SET_DEST (set))) - <= UNITS_PER_WORD) - && (GET_MODE_CLASS (GET_MODE (SET_DEST (set))) - == MODE_INT) - && SUBREG_REG (SET_DEST (set)) == x)) - && basic_induction_var (SET_SRC (set), - (GET_MODE (SET_SRC (set)) == VOIDmode - ? GET_MODE (x) - : GET_MODE (SET_SRC (set))), - dest_reg, insn, - inc_val, mult_val, location)) - return 1; + dest = SET_DEST (set); + if (dest == x + || (GET_CODE (dest) == SUBREG + && (GET_MODE_SIZE (GET_MODE (dest)) <= UNITS_PER_WORD) + && (GET_MODE_CLASS (GET_MODE (dest)) == MODE_INT) + && SUBREG_REG (dest) == x)) + return basic_induction_var (SET_SRC (set), + (GET_MODE (SET_SRC (set)) == VOIDmode + ? GET_MODE (x) + : GET_MODE (SET_SRC (set))), + dest_reg, insn, + inc_val, mult_val, location); + + while (GET_CODE (dest) == SIGN_EXTRACT + || GET_CODE (dest) == ZERO_EXTRACT + || GET_CODE (dest) == SUBREG + || GET_CODE (dest) == STRICT_LOW_PART) + dest = XEXP (dest, 0); + if (dest == x) + break; } /* ... fall through ... */