tree-parloops.c (parallelize_loops): Also consult the upper bound for the number...
authorRichard Guenther <rguenther@suse.de>
Thu, 12 Apr 2012 10:13:22 +0000 (10:13 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 12 Apr 2012 10:13:22 +0000 (10:13 +0000)
2012-04-12  Richard Guenther  <rguenther@suse.de>

* tree-parloops.c (parallelize_loops): Also consult the upper
bound for the number of iterations.
* tree-ssa-loop-prefetch.c (determine_loop_nest_reuse): Likewise.
(loop_prefetch_arrays): Likewise.

From-SVN: r186373

gcc/ChangeLog
gcc/tree-parloops.c
gcc/tree-ssa-loop-prefetch.c

index d702e02d88670ca9e61d1980c3064a56dae61103..7891046da8f4833fb797b898329d37a6a53b6024 100644 (file)
@@ -1,3 +1,10 @@
+2012-04-12  Richard Guenther  <rguenther@suse.de>
+
+       * tree-parloops.c (parallelize_loops): Also consult the upper
+       bound for the number of iterations.
+       * tree-ssa-loop-prefetch.c (determine_loop_nest_reuse): Likewise.
+       (loop_prefetch_arrays): Likewise.
+
 2012-04-12  Richard Guenther  <rguenther@suse.de>
 
        * cfgloop.h (estimated_loop_iterations_int): Ditch
index a7f4f9026b782bcbf674fc5dfe6d440c9c93240e..af43ed04c6658939815fd0381ea54a4a8bf89615 100644 (file)
@@ -2192,12 +2192,15 @@ parallelize_loops (void)
             header-copied loops correctly - see PR46886.  */
          || !do_while_loop_p (loop))
        continue;
+
       estimated = estimated_stmt_executions_int (loop);
+      if (estimated == -1)
+       estimated = max_stmt_executions_int (loop);
       /* FIXME: Bypass this check as graphite doesn't update the
-      count and frequency correctly now.  */
+        count and frequency correctly now.  */
       if (!flag_loop_parallelize_all
-         && ((estimated !=-1 
-            && estimated <= (HOST_WIDE_INT) n_threads * MIN_PER_THREAD)
+         && ((estimated != -1
+              && estimated <= (HOST_WIDE_INT) n_threads * MIN_PER_THREAD)
              /* Do not bother with loops in cold areas.  */
              || optimize_loop_nest_for_size_p (loop)))
        continue;
index eab1fff221842663ffdab667dbe7e1f57782e524..19a6a22d9594340b22107ced8ea55a2b83ed9bd2 100644 (file)
@@ -1549,7 +1549,7 @@ determine_loop_nest_reuse (struct loop *loop, struct mem_ref_group *refs,
 
       aloop = VEC_index (loop_p, vloops, i);
       vol = estimated_stmt_executions_int (aloop);
-      if (vol < 0)
+      if (vol == -1)
        vol = expected_loop_iterations (aloop);
       volume *= vol;
     }
@@ -1801,6 +1801,8 @@ loop_prefetch_arrays (struct loop *loop)
 
   ahead = (PREFETCH_LATENCY + time - 1) / time;
   est_niter = estimated_stmt_executions_int (loop);
+  if (est_niter == -1)
+    est_niter = max_stmt_executions_int (loop);
 
   /* Prefetching is not likely to be profitable if the trip count to ahead
      ratio is too small.  */