]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Backport a change to the 2.95 branch
authorBernd Schmidt <bernds@redhat.co.uk>
Thu, 30 Nov 2000 14:16:55 +0000 (14:16 +0000)
committerBernd Schmidt <bernds@gcc.gnu.org>
Thu, 30 Nov 2000 14:16:55 +0000 (14:16 +0000)
From-SVN: r37892

gcc/ChangeLog
gcc/loop.c

index 96efcf396431d057ec079814a208f9330ed56dfd..2e140caed00cc22cca62ad582617b95a98a2291f 100644 (file)
@@ -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
index 3991a71fdb8b316e486700661c437063aa8f3385..1aa56b75029a9978d8a190b25b79629c0e1b712e 100644 (file)
@@ -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 ...  */