]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-ssa-loop-niter.c (find_loop_niter): Remove just_once_each_iteration_p.
authorJan Hubicka <jh@suse.cz>
Mon, 5 Nov 2012 11:14:16 +0000 (12:14 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Mon, 5 Nov 2012 11:14:16 +0000 (11:14 +0000)
* tree-ssa-loop-niter.c (find_loop_niter): Remove just_once_each_iteration_p.
(maybe_lower_iteration_bound): Initialize not_executed_last_iteration to  NULL
* tree-ssa-loop-ivcanon.c (canonicalize_loop_induction_variables): Skip
just_once_each_iteration_p; record estimated bound when loop has only one
likely exit; test just_once_each_iteration_p before IV canon itself.

From-SVN: r193159

gcc/ChangeLog
gcc/tree-ssa-loop-ivcanon.c
gcc/tree-ssa-loop-niter.c

index ed65951ed89f93dd41a2a54460835bea761f770b..be526da445b2d2b220400ed6def37f5be8edf170 100644 (file)
@@ -4,6 +4,14 @@
        * dwarf2out.c (value_format) <case dw_val_class_high_pc>: Handle
        also DWARF2_ADDR_SIZE 1 and 2.
 
+2012-11-05  Jan Hubicka  <jh@suse.cz>
+
+       * tree-ssa-loop-niter.c (find_loop_niter): Remove just_once_each_iteration_p.
+       (maybe_lower_iteration_bound): Initialize not_executed_last_iteration to  NULL
+       * tree-ssa-loop-ivcanon.c (canonicalize_loop_induction_variables): Skip
+       just_once_each_iteration_p; record estimated bound when loop has only one
+       likely exit; test just_once_each_iteration_p before IV canon itself.
+
 2012-11-05  Jan Hubicka  <jh@suse.cz>
 
        * ipa-inline.c (leaf_node_p): Rename to ...
index 433bb7783cf3320e54af5ca18b2f1ebd2eec49c4..58f45d2d1c4b314bfc3a1a2010865482c397c685 100644 (file)
@@ -760,11 +760,7 @@ canonicalize_loop_induction_variables (struct loop *loop,
 
   niter = number_of_latch_executions (loop);
   if (TREE_CODE (niter) == INTEGER_CST)
-    {
-      exit = single_exit (loop);
-      if (!just_once_each_iteration_p (loop, exit->src))
-       return false;
-    }
+    exit = single_exit (loop);
   else
     {
       /* If the loop has more than one exit, try checking all of them
@@ -785,7 +781,10 @@ canonicalize_loop_induction_variables (struct loop *loop,
   /* We work exceptionally hard here to estimate the bound
      by find_loop_niter_by_eval.  Be sure to keep it for future.  */
   if (niter && TREE_CODE (niter) == INTEGER_CST)
-    record_niter_bound (loop, tree_to_double_int (niter), false, true);
+    {
+      record_niter_bound (loop, tree_to_double_int (niter),
+                         exit == single_likely_exit (loop), true);
+    }
 
   /* Force re-computation of loop bounds so we can remove redundant exits.  */
   maxiter = max_loop_iterations_int (loop);
@@ -813,7 +812,8 @@ canonicalize_loop_induction_variables (struct loop *loop,
     return true;
 
   if (create_iv
-      && niter && !chrec_contains_undetermined (niter))
+      && niter && !chrec_contains_undetermined (niter)
+      && exit && just_once_each_iteration_p (loop, exit->src))
     create_canonical_iv (loop, exit, niter);
 
   return modified;
index 3fd34c145282980e855260c9961939be1047bd19..87b550cf5b4e8de24c54af1813659d30b41f80f7 100644 (file)
@@ -1941,9 +1941,6 @@ find_loop_niter (struct loop *loop, edge *exit)
   *exit = NULL;
   FOR_EACH_VEC_ELT (edge, exits, i, ex)
     {
-      if (!just_once_each_iteration_p (loop, ex->src))
-       continue;
-
       if (!number_of_iterations_exit (loop, ex, &desc, false))
        continue;
 
@@ -3186,7 +3183,7 @@ discover_iteration_bound_by_body_walk (struct loop *loop)
 static void
 maybe_lower_iteration_bound (struct loop *loop)
 {
-  pointer_set_t *not_executed_last_iteration = pointer_set_create ();
+  pointer_set_t *not_executed_last_iteration = NULL;
   struct nb_iter_bound *elt;
   bool found_exit = false;
   VEC (basic_block, heap) *queue = NULL;