loop.c (check_final_value): A GIV is not replaceable if used before set.
authorFranz Sirl <Franz.Sirl-kernel@lauterbach.com>
Fri, 29 Sep 2000 17:38:25 +0000 (17:38 +0000)
committerFranz Sirl <sirl@gcc.gnu.org>
Fri, 29 Sep 2000 17:38:25 +0000 (17:38 +0000)
2000-09-29  Franz Sirl  <Franz.Sirl-kernel@lauterbach.com>
* loop.c (check_final_value): A GIV is not replaceable if used
before set.

From-SVN: r36668

gcc/ChangeLog
gcc/loop.c

index 2a32857578b03f177eb0e097c4405c635b221181..86baeccd6ba2c433fac0928ad09f2b58571b2ca2 100644 (file)
@@ -1,3 +1,8 @@
+2000-09-29  Franz Sirl  <Franz.Sirl-kernel@lauterbach.com>
+
+       * loop.c (check_final_value): A GIV is not replaceable if used
+       before set.
+
 Fri Sep 29 10:04:12 2000  Jeffrey A Law  (law@cygnus.com)
 
        * version.c: Bump to gcc-2.97.
@@ -62,6 +67,7 @@ Fri Sep 29 13:20:42 MET DST 2000  Jan Hubicka  <jh@suse.cz>
        * configure: Rebuilt.
 
 2000-09-28  Franz Sirl  <Franz.Sirl-kernel@lauterbach.com>
+
        * doloop.c (doloop_modify): Prevent delete_insn() from
        deleting too much.  Prefer loop->top over loop->start as
        target for the new JUMP insn.
@@ -2743,16 +2749,6 @@ Sat Sep  2 13:58:23 2000  Marek Michalkiewicz <marekm@linux.org.pl>
        * config/avr/avr.md ("*negsi2"): substitute %@ to __zero_reg__
        * config/avr/libgcc.S: Lost part of the previous patch.
 
-2000-08-31  Franz Sirl  <Franz.Sirl-kernel@lauterbach.com>
-
-       * rs6000/rs6000.h (NO_DOLLAR_IN_LABEL, DOLLARS_IN_IDENTIFIERS,
-       ENCODE_SECTION_INFO, ASM_OUTPUT_SPECIAL_POOL_ENTRY_P): Move from
-       here...
-       * rs6000/aix.h: ...to here.
-       * rs6000/linux.h (ASM_APP_ON, ASM_APP_OFF): Define to Linux-style.
-       * rs6000/rs6000.c (rs6000_select_section): Handle CONSTRUCTOR.
-       (rs6000_unique_section): Likewise.
-
 2000-08-31  J. David Anglin  <dave@hiauly1.hia.nrc.ca>
 
        * gthr-dce.h (__gthread_objc_mutex_allocate): Create a pthread_mutex_t
index b53b148eadf7986c7d8f2fd87ead2b9cbe888528..f685b3962e871b9505f393d1e36ceebcdd8563ca 100644 (file)
@@ -5094,6 +5094,7 @@ check_final_value (loop, v)
         or all uses follow that insn in the same basic block),
      - its final value can be calculated (this condition is different
        than the one above in record_giv)
+     - it's not used before the it's set
      - no assignments to the biv occur during the giv's lifetime.  */
 
 #if 0
@@ -5105,7 +5106,7 @@ check_final_value (loop, v)
   if ((final_value = final_giv_value (loop, v))
       && (v->always_computable || last_use_this_basic_block (v->dest_reg, v->insn)))
     {
-      int biv_increment_seen = 0;
+      int biv_increment_seen = 0, before_giv_insn = 0;
       rtx p = v->insn;
       rtx last_giv_use;
 
@@ -5135,7 +5136,10 @@ check_final_value (loop, v)
        {
          p = NEXT_INSN (p);
          if (p == loop->end)
-           p = NEXT_INSN (loop->start);
+           {
+             before_giv_insn = 1;
+             p = NEXT_INSN (loop->start);
+           }
          if (p == v->insn)
            break;
 
@@ -5153,7 +5157,7 @@ check_final_value (loop, v)
 
              if (reg_mentioned_p (v->dest_reg, PATTERN (p)))
                {
-                 if (biv_increment_seen)
+                 if (biv_increment_seen || before_giv_insn)
                    {
                      v->replaceable = 0;
                      v->not_replaceable = 1;
@@ -5438,14 +5442,13 @@ basic_induction_var (loop, x, mode, dest_reg, p, inc_val, mult_val, location)
                       <= UNITS_PER_WORD)
                   && (GET_MODE_CLASS (GET_MODE (SET_DEST (set)))
                       == MODE_INT)
-                  && SUBREG_REG (SET_DEST (set)) == x))
-             && basic_induction_var (loop, 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;
+                  && SUBREG_REG (SET_DEST (set)) == x)))
+             return basic_induction_var (loop, 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);
        }
       /* Fall through.  */