diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 60d315500ab36b503a83500cba5645bc3c3a0561..49a8109df1d247c079e6df26126ed1cf27a62bb6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,28 @@ +2017-06-19 Richard Biener <rguenther@suse.de> + + * tree-ssa-loop-niter.h (estimate_numbers_of_iterations): Take + struct function as arg. + (estimate_numbers_of_iterations): Export overload with loop arg. + (free_numbers_of_iterations_estimates_loop): Use an overload of + free_numbers_of_iterations_estimates instead. + * tree-cfg.c (remove_bb): Adjust. + * tree-cfgcleanup.c (remove_forwarder_block_with_phi): Likewise. + * tree-parloops.c (gen_parallel_loop): Likewise. + * tree-ssa-loop-ivcanon.c (canonicalize_induction_variables): + Likewise. + (tree_unroll_loops_completely): Likewise. + * tree-ssa-loop-niter.c (estimate_numbers_of_iterations_loop): + Use an overload instead and export. + (estimated_loop_iterations): Adjust. + (max_loop_iterations): Likewise. + (likely_max_loop_iterations): Likewise. + (estimate_numbers_of_iterations): Take struct function as arg + and adjust. + (loop_exits_before_overflow): Adjust. + (free_numbers_of_iterations_estimates_loop): Use an overload. + * tree-vect-loop.c (vect_analyze_loop_form): Adjust. + * tree-vectorizer.c (vect_free_loop_info_assumptions): Likewise. + 2017-06-19 Richard Biener <rguenther@suse.de> PR ipa/81112 diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 7df80f8ee8c6e6f3c1773ce95732a109ace6b3fe..589508df0443df378899a8307375f89af2f1cf87 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -2177,7 +2177,7 @@ remove_bb (basic_block bb) with it. */ if (loop->latch == bb || loop->header == bb) - free_numbers_of_iterations_estimates_loop (loop); + free_numbers_of_iterations_estimates (loop); } /* Remove all the instructions in the block. */ diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c index 94a172fa98e494efeb552c9903e7c456f16e31d4..4cab592ee772f6d5847fba9979ef07996de15793 100644 --- a/gcc/tree-cfgcleanup.c +++ b/gcc/tree-cfgcleanup.c @@ -959,7 +959,7 @@ remove_forwarder_block_with_phi (basic_block bb) { dest->loop_father->any_upper_bound = false; dest->loop_father->any_likely_upper_bound = false; - free_numbers_of_iterations_estimates_loop (dest->loop_father); + free_numbers_of_iterations_estimates (dest->loop_father); } } diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index 641f675edf749c97ad6940174718b360ee794477..79d616b760ad48560740efd18405c9e218ecd423 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -2436,8 +2436,7 @@ gen_parallel_loop (struct loop *loop, /* Free loop bound estimations that could contain references to removed statements. */ - FOR_EACH_LOOP (loop, 0) - free_numbers_of_iterations_estimates_loop (loop); + free_numbers_of_iterations_estimates (cfun); } /* Returns true when LOOP contains vector phi nodes. */ diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c index 82ad59c42530281689091e36e7d8df87d3269d80..b6ac765aac697d893f7da1a601de232f19c45369 100644 --- a/gcc/tree-ssa-loop-ivcanon.c +++ b/gcc/tree-ssa-loop-ivcanon.c @@ -1215,7 +1215,7 @@ canonicalize_induction_variables (void) bool irred_invalidated = false; bitmap loop_closed_ssa_invalidated = BITMAP_ALLOC (NULL); - estimate_numbers_of_iterations (); + estimate_numbers_of_iterations (cfun); FOR_EACH_LOOP (loop, LI_FROM_INNERMOST) { @@ -1361,6 +1361,8 @@ tree_unroll_loops_completely (bool may_increase_size, bool unroll_outer) int iteration = 0; bool irred_invalidated = false; + estimate_numbers_of_iterations (cfun); + do { changed = false; @@ -1370,7 +1372,7 @@ tree_unroll_loops_completely (bool may_increase_size, bool unroll_outer) loop_closed_ssa_invalidated = BITMAP_ALLOC (NULL); free_numbers_of_iterations_estimates (cfun); - estimate_numbers_of_iterations (); + estimate_numbers_of_iterations (cfun); changed = tree_unroll_loops_completely_1 (may_increase_size, unroll_outer, father_bbs, @@ -1588,7 +1590,6 @@ pass_complete_unrolli::execute (function *fun) { scev_initialize (); ret = tree_unroll_loops_completely (optimize >= 3, false); - free_numbers_of_iterations_estimates (fun); scev_finalize (); } loop_optimizer_finalize (); diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index b1f14078b4fa071a8f4648798b3017650d6c9cd3..848e812cb96b4efd24b0d831176e41a347730994 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -3786,8 +3786,8 @@ maybe_lower_iteration_bound (struct loop *loop) /* Records estimates on numbers of iterations of LOOP. If USE_UNDEFINED_P is true also use estimates derived from undefined behavior. */ -static void -estimate_numbers_of_iterations_loop (struct loop *loop) +void +estimate_numbers_of_iterations (struct loop *loop) { vec<edge> exits; tree niter, type; @@ -3876,7 +3876,7 @@ estimated_loop_iterations (struct loop *loop, widest_int *nit) /* When SCEV information is available, try to update loop iterations estimate. Otherwise just return whatever we recorded earlier. */ if (scev_initialized_p ()) - estimate_numbers_of_iterations_loop (loop); + estimate_numbers_of_iterations (loop); return (get_estimated_loop_iterations (loop, nit)); } @@ -3912,7 +3912,7 @@ max_loop_iterations (struct loop *loop, widest_int *nit) /* When SCEV information is available, try to update loop iterations estimate. Otherwise just return whatever we recorded earlier. */ if (scev_initialized_p ()) - estimate_numbers_of_iterations_loop (loop); + estimate_numbers_of_iterations (loop); return get_max_loop_iterations (loop, nit); } @@ -3947,7 +3947,7 @@ likely_max_loop_iterations (struct loop *loop, widest_int *nit) /* When SCEV information is available, try to update loop iterations estimate. Otherwise just return whatever we recorded earlier. */ if (scev_initialized_p ()) - estimate_numbers_of_iterations_loop (loop); + estimate_numbers_of_iterations (loop); return get_likely_max_loop_iterations (loop, nit); } @@ -4051,7 +4051,7 @@ estimated_stmt_executions (struct loop *loop, widest_int *nit) /* Records estimates on numbers of iterations of loops. */ void -estimate_numbers_of_iterations (void) +estimate_numbers_of_iterations (function *fn) { struct loop *loop; @@ -4059,10 +4059,8 @@ estimate_numbers_of_iterations (void) loop iteration estimates. */ fold_defer_overflow_warnings (); - FOR_EACH_LOOP (loop, 0) - { - estimate_numbers_of_iterations_loop (loop); - } + FOR_EACH_LOOP_FN (fn, loop, 0) + estimate_numbers_of_iterations (loop); fold_undefer_and_ignore_overflow_warnings (); } @@ -4235,7 +4233,7 @@ loop_exits_before_overflow (tree base, tree step, valid_niter = fold_build2 (FLOOR_DIV_EXPR, unsigned_type, delta, step_abs); - estimate_numbers_of_iterations_loop (loop); + estimate_numbers_of_iterations (loop); if (max_loop_iterations (loop, &niter) && wi::fits_to_tree_p (niter, TREE_TYPE (valid_niter)) @@ -4502,7 +4500,7 @@ scev_probably_wraps_p (tree var, tree base, tree step, /* Frees the information on upper bounds on numbers of iterations of LOOP. */ void -free_numbers_of_iterations_estimates_loop (struct loop *loop) +free_numbers_of_iterations_estimates (struct loop *loop) { struct control_iv *civ; struct nb_iter_bound *bound; @@ -4534,9 +4532,7 @@ free_numbers_of_iterations_estimates (function *fn) struct loop *loop; FOR_EACH_LOOP_FN (fn, loop, 0) - { - free_numbers_of_iterations_estimates_loop (loop); - } + free_numbers_of_iterations_estimates (loop); } /* Substitute value VAL for ssa name NAME inside expressions held diff --git a/gcc/tree-ssa-loop-niter.h b/gcc/tree-ssa-loop-niter.h index b0098570d09a884e831584fa5fba93b833b9ff5e..8161cc76fd738ce009888a998f40dba7bb2d38eb 100644 --- a/gcc/tree-ssa-loop-niter.h +++ b/gcc/tree-ssa-loop-niter.h @@ -45,13 +45,13 @@ extern HOST_WIDE_INT estimated_stmt_executions_int (struct loop *); extern bool max_stmt_executions (struct loop *, widest_int *); extern bool likely_max_stmt_executions (struct loop *, widest_int *); extern bool estimated_stmt_executions (struct loop *, widest_int *); -extern void estimate_numbers_of_iterations (void); +extern void estimate_numbers_of_iterations (function *); +extern void estimate_numbers_of_iterations (struct loop *); extern bool stmt_dominates_stmt_p (gimple *, gimple *); extern bool nowrap_type_p (tree); extern bool scev_probably_wraps_p (tree, tree, tree, gimple *, struct loop *, bool); -extern void free_loop_control_ivs (struct loop *); -extern void free_numbers_of_iterations_estimates_loop (struct loop *); +extern void free_numbers_of_iterations_estimates (struct loop *); extern void free_numbers_of_iterations_estimates (function *); extern void substitute_in_loop_info (struct loop *, tree, tree); diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index b8b49c9fde459b89e72af3af7401bfbc5feda105..d601296ab3e4280773184ce25cd249bf7c424957 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -1570,7 +1570,7 @@ vect_analyze_loop_form (struct loop *loop) some assumptions. In order to do this, we need to clear existing information computed by scev and niter analyzer. */ scev_reset_htab (); - free_numbers_of_iterations_estimates_loop (loop); + free_numbers_of_iterations_estimates (loop); /* Also set flag for this loop so that following scev and niter analysis are done under the assumptions. */ loop_constraint_set (loop, LOOP_C_FINITE); diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c index 1bef2e4f800a44bd4b836193a35396b06cb80541..0d62c829ef5875f7ce6732d82e64601e79b2b130 100644 --- a/gcc/tree-vectorizer.c +++ b/gcc/tree-vectorizer.c @@ -380,10 +380,10 @@ vect_free_loop_info_assumptions (struct loop *loop) { scev_reset_htab (); /* We need to explicitly reset upper bound information since they are - used even after free_numbers_of_iterations_estimates_loop. */ + used even after free_numbers_of_iterations_estimates. */ loop->any_upper_bound = false; loop->any_likely_upper_bound = false; - free_numbers_of_iterations_estimates_loop (loop); + free_numbers_of_iterations_estimates (loop); loop_constraint_clear (loop, LOOP_C_FINITE); }