* params.def: Add avg-loop niter.
* tree-ssa-loop-ivopts.c (avg_loop_niter): Use the param.
* cfgloopanal.c (expected_loop_iterations_unbounded): Likewise.
* doc/invoke.texi: Document the new parameter.
From-SVN: r238252
+2016-07-12 Martin Liska <mliska@suse.cz>
+
+ * params.def: Add avg-loop niter.
+ * tree-ssa-loop-ivopts.c (avg_loop_niter): Use the param.
+ * cfgloopanal.c (expected_loop_iterations_unbounded): Likewise.
+ * doc/invoke.texi: Document the new parameter.
+
2016-07-12 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
PR middle-end/71700
if (read_profile_p)
*read_profile_p = false;
- /* Average loop rolls about 3 times. If we have no profile at all, it is
- best we can do. */
+ /* If we have no profile at all, use AVG_LOOP_NITER. */
if (profile_status_for_fn (cfun) == PROFILE_ABSENT)
- expected = 3;
+ expected = PARAM_VALUE (PARAM_AVG_LOOP_NITER);
else if (loop->latch->count || loop->header->count)
{
gcov_type count_in, count_latch;
if (freq_in == 0)
{
- /* If we have no profile at all, expect 3 iterations. */
+ /* If we have no profile at all, use AVG_LOOP_NITER iterations. */
if (!freq_latch)
- expected = 3;
+ expected = PARAM_VALUE (PARAM_AVG_LOOP_NITER);
else
expected = freq_latch * 2;
}
always try to remove unnecessary ivs from the set
when adding a new one.
+@item avg-loop-niter
+Average number of iterations of a loop.
+
@item scev-max-expr-size
Bound on size of expressions used in the scalar evolutions analyzer.
Large expressions slow the analyzer.
"If number of candidates in the set is smaller, we always try to remove unused ivs during its optimization.",
10, 0, 0)
+DEFPARAM(PARAM_AVG_LOOP_NITER,
+ "avg-loop-niter",
+ "Average number of iterations of a loop.",
+ 10, 1, 0)
+
DEFPARAM(PARAM_SCEV_MAX_EXPR_SIZE,
"scev-max-expr-size",
"Bound on size of expressions used in the scalar evolutions analyzer.",
/* The infinite cost. */
#define INFTY 10000000
-#define AVG_LOOP_NITER(LOOP) 5
-
/* Returns the expected number of loop iterations for LOOP.
The average trip count is computed from profile data if it
exists. */
if (niter == -1)
{
niter = likely_max_stmt_executions_int (loop);
- if (niter == -1 || niter > AVG_LOOP_NITER (loop))
- return AVG_LOOP_NITER (loop);
+
+ if (niter == -1 || niter > PARAM_VALUE (PARAM_AVG_LOOP_NITER))
+ return PARAM_VALUE (PARAM_AVG_LOOP_NITER);
}
return niter;