Commit adb7eaa2 by Richard Biener Committed by Richard Biener

tree-ssa-loop-niter.h (estimate_numbers_of_iterations): Take struct function as arg.

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.

From-SVN: r249358
parent db9bbdec
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
* ipa-prop.c (find_constructor_constant_at_offset): Handle
RANGE_EXPR conservatively.
......
......@@ -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. */
......
......@@ -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);
}
}
......
......@@ -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. */
......
......@@ -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 ();
......
......@@ -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
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment