Revert r234572 (aka PR testsuite/70577)
authorMartin Liska <mliska@suse.cz>
Tue, 12 Apr 2016 13:38:46 +0000 (15:38 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Tue, 12 Apr 2016 13:38:46 +0000 (13:38 +0000)
Revert
2016-03-30  Jan Hubicka  <hubicka@ucw.cz>

* tree-ssa-loop-niter.c (idx_infer_loop_bounds): We can't get realistic
estimates here.
* tree-ssa-loop-unswitch.c (tree_unswitch_single_loop): Use also
max_loop_iterations_int.
(tree_unswitch_outer_loop): Likewise.
* tree-ssa-loop-ivopts.c (avg_loop_niter): Likewise.
* tree-vect-loop.c (vect_analyze_loop_2): Likewise.

From-SVN: r234902

gcc/ChangeLog
gcc/tree-ssa-loop-ivopts.c
gcc/tree-ssa-loop-niter.c
gcc/tree-ssa-loop-unswitch.c
gcc/tree-vect-loop.c

index 52354c9..1e93515 100644 (file)
@@ -1,3 +1,16 @@
+2016-04-12  Martin Liska  <mliska@suse.cz>
+
+       Revert
+       2016-03-30  Jan Hubicka  <hubicka@ucw.cz>
+
+       * tree-ssa-loop-niter.c (idx_infer_loop_bounds): We can't get realistic
+       estimates here.
+       * tree-ssa-loop-unswitch.c (tree_unswitch_single_loop): Use also
+       max_loop_iterations_int.
+       (tree_unswitch_outer_loop): Likewise.
+       * tree-ssa-loop-ivopts.c (avg_loop_niter): Likewise.
+       * tree-vect-loop.c (vect_analyze_loop_2): Likewise.
+
 2016-04-12  Tom de Vries  <tom@codesourcery.com>
 
        PR tree-optimization/68756
index 7be4f16..a016e9f 100644 (file)
@@ -121,11 +121,7 @@ avg_loop_niter (struct loop *loop)
 {
   HOST_WIDE_INT niter = estimated_stmt_executions_int (loop);
   if (niter == -1)
-    {
-      niter = max_stmt_executions_int (loop);
-      if (niter == -1 || niter > AVG_LOOP_NITER (loop))
-        return AVG_LOOP_NITER (loop);
-    }
+    return AVG_LOOP_NITER (loop);
 
   return niter;
 }
index c93e563..81689fc 100644 (file)
@@ -3115,6 +3115,7 @@ idx_infer_loop_bounds (tree base, tree *idx, void *dta)
   tree low, high, type, next;
   bool sign, upper = true, at_end = false;
   struct loop *loop = data->loop;
+  bool reliable = true;
 
   if (TREE_CODE (base) != ARRAY_REF)
     return true;
@@ -3186,14 +3187,14 @@ idx_infer_loop_bounds (tree base, tree *idx, void *dta)
       && tree_int_cst_compare (next, high) <= 0)
     return true;
 
-  /* If access is not executed on every iteration, we must ensure that overlow
-     may not make the access valid later.  */
+  /* If access is not executed on every iteration, we must ensure that overlow may
+     not make the access valid later.  */
   if (!dominated_by_p (CDI_DOMINATORS, loop->latch, gimple_bb (data->stmt))
       && scev_probably_wraps_p (initial_condition_in_loop_num (ev, loop->num),
                                step, data->stmt, loop, true))
-    upper = false;
+    reliable = false;
 
-  record_nonwrapping_iv (loop, init, step, data->stmt, low, high, false, upper);
+  record_nonwrapping_iv (loop, init, step, data->stmt, low, high, reliable, upper);
   return true;
 }
 
index 77acd66..dd6fd01 100644 (file)
@@ -223,8 +223,6 @@ tree_unswitch_single_loop (struct loop *loop, int num)
       /* If the loop is not expected to iterate, there is no need
         for unswitching.  */
       iterations = estimated_loop_iterations_int (loop);
-      if (iterations < 0)
-        iterations = max_loop_iterations_int (loop);
       if (iterations >= 0 && iterations <= 1)
        {
          if (dump_file && (dump_flags & TDF_DETAILS))
@@ -441,8 +439,6 @@ tree_unswitch_outer_loop (struct loop *loop)
   /* If the loop is not expected to iterate, there is no need
       for unswitching.  */
   iterations = estimated_loop_iterations_int (loop);
-  if (iterations < 0)
-    iterations = max_loop_iterations_int (loop);
   if (iterations >= 0 && iterations <= 1)
     {
       if (dump_file && (dump_flags & TDF_DETAILS))
index f977ee9..d813b86 100644 (file)
@@ -2063,8 +2063,6 @@ start_over:
 
   estimated_niter
     = estimated_stmt_executions_int (LOOP_VINFO_LOOP (loop_vinfo));
-  if (estimated_niter != -1)
-    estimated_niter = max_niter;
   if (estimated_niter != -1
       && ((unsigned HOST_WIDE_INT) estimated_niter
           <= MAX (th, (unsigned)min_profitable_estimate)))