loop.c (scan_loop): Call reg_in_basic_block_p before loop_reg_used_before_p.
authorMichael Hayes <m.hayes@elec.canterbury.ac.nz>
Sat, 13 Feb 1999 14:25:58 +0000 (14:25 +0000)
committerMichael Hayes <m.hayes@gcc.gnu.org>
Sat, 13 Feb 1999 14:25:58 +0000 (14:25 +0000)
* loop.c (scan_loop): Call reg_in_basic_block_p before
loop_reg_used_before_p.

From-SVN: r25182

gcc/ChangeLog
gcc/loop.c

index 719472fb186307543ffce9e85b8f0952499aabdc..b495dfcdff1f346186d570a5b5e4cd7fbba7465a 100644 (file)
@@ -1,3 +1,8 @@
+Sun Feb 14 11:24:05 1999  Michael Hayes  <m.hayes@elec.canterbury.ac.nz>
+
+       * loop.c (scan_loop): Call reg_in_basic_block_p before
+       loop_reg_used_before_p.
+
 Sat Feb 13 05:32:00 1999  Richard Earnshaw (rearnsha@arm.com)
 
        * arm.md: Use gen_rtx_FOO instead of gen_rtx (FOO, ...).
index 12b52adbb79a24f357b3e54349e704303810af15..9e230a63ade843aaefccb646b87069da8e1eb039 100644 (file)
@@ -851,17 +851,23 @@ scan_loop (loop_start, end, loop_cont, unroll_p, bct_p)
             We don't know its life-span, so we can't compute the benefit.  */
          if (REGNO (SET_DEST (set)) >= max_reg_before_loop)
            ;
-         else if (/* The set is not guaranteed to be executed one
-                     the loop starts, or the value before the set is
-                     needed before the set occurs... */
-                  (maybe_never
-                   || loop_reg_used_before_p (set, p, loop_start,
-                                              scan_start, end))
-                  /* And the register is used in basic blocks other
+         else if (/* The register is used in basic blocks other
                      than the one where it is set (meaning that
                      something after this point in the loop might
                      depend on its value before the set).  */
-                  && !reg_in_basic_block_p (p, SET_DEST (set)))
+                  ! reg_in_basic_block_p (p, SET_DEST (set))
+                  /* And the set is not guaranteed to be executed one
+                     the loop starts, or the value before the set is
+                     needed before the set occurs... 
+
+                     ??? Note we have quadratic behaviour here, mitigated
+                     by the fact that the previous test will often fail for
+                     large loops.  Rather than re-scanning the entire loop
+                     each time for register usage, we should build tables
+                     of the register usage and use them here instead.  */
+                  && (maybe_never
+                      || loop_reg_used_before_p (set, p, loop_start,
+                                                 scan_start, end)))
            /* It is unsafe to move the set.  
 
               This code used to consider it OK to move a set of a variable