+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
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. */
{
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);
}
}
/* 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. */
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)
{
int iteration = 0;
bool irred_invalidated = false;
+ estimate_numbers_of_iterations (cfun);
+
do
{
changed = false;
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,
{
scev_initialize ();
ret = tree_unroll_loops_completely (optimize >= 3, false);
- free_numbers_of_iterations_estimates (fun);
scev_finalize ();
}
loop_optimizer_finalize ();
/* 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;
/* 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));
}
/* 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);
}
/* 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);
}
/* Records estimates on numbers of iterations of loops. */
void
-estimate_numbers_of_iterations (void)
+estimate_numbers_of_iterations (function *fn)
{
struct loop *loop;
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 ();
}
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))
/* 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;
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
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);
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);
{
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);
}