summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorBernd Schmidt <bernds@redhat.co.uk>2000-11-30 14:16:55 +0000
committerBernd Schmidt <bernds@gcc.gnu.org>2000-11-30 14:16:55 +0000
commita8c23b3a9e263627b52d7b9d6d7aa5c1eb049195 (patch)
tree2a1a818db3bb5515e137579a36e65c83a5d3ebaf /gcc
parent71e2a3f193e6c4c0e98ebced1db482a04bbba335 (diff)
downloadgcc-a8c23b3a9e263627b52d7b9d6d7aa5c1eb049195.tar.gz
Backport a change to the 2.95 branch
From-SVN: r37892
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/loop.c35
2 files changed, 26 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 96efcf39643..2e140caed00 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2000-11-30 Bernd Schmidt <bernds@redhat.co.uk>
+ Based on a patch from Geoff Keating <geoffk@redhat.com>:
+ * 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 <wilson@cygnus.com>
* 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 3991a71fdb8..1aa56b75029 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 ... */