summaryrefslogtreecommitdiff
path: root/gcc/cfgloopanal.c
diff options
context:
space:
mode:
authorrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2007-04-06 23:11:15 +0000
committerrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2007-04-06 23:11:15 +0000
commitd97e22fb65bb6365d79ae4f291981c27bc0f954a (patch)
tree6e9884d45709a7814b362ea6e6dbf57ecb1ab63e /gcc/cfgloopanal.c
parent24fbb6038f8768e9a8e7ad118abfd18b9f6aa221 (diff)
downloadgcc-d97e22fb65bb6365d79ae4f291981c27bc0f954a.tar.gz
* tree-ssa-loop-niter.c (idx_infer_loop_bounds): Add and use
argument "reliable". (infer_loop_bounds_from_ref, infer_loop_bounds_from_array): Add argument "reliable". Propagate it through calls. (infer_loop_bounds_from_undefined): Derive number of iterations estimates from references in blocks that do not dominate loop latch. (gcov_type_to_double_int): New function. (estimate_numbers_of_iterations_loop): Use gcov_type_to_double_int and expected_loop_iterations_unbounded. * cfgloopanal.c (expected_loop_iterations_unbounded): New function. (expected_loop_iterations): Use expected_loop_iterations_unbounded. * tree-data-ref.c (estimated_loop_iterations): Export. (get_references_in_stmt): Fix -- do not return addresses of local objects. * cfgloop.h (expected_loop_iterations_unbounded, estimated_loop_iterations): Declare. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123630 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfgloopanal.c')
-rw-r--r--gcc/cfgloopanal.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/gcc/cfgloopanal.c b/gcc/cfgloopanal.c
index 5a9189787ea..4612ab8f1a1 100644
--- a/gcc/cfgloopanal.c
+++ b/gcc/cfgloopanal.c
@@ -423,11 +423,12 @@ average_num_loop_insns (struct loop *loop)
return ninsns;
}
-/* Returns expected number of LOOP iterations.
- Compute upper bound on number of iterations in case they do not fit integer
- to help loop peeling heuristics. Use exact counts if at all possible. */
-unsigned
-expected_loop_iterations (const struct loop *loop)
+/* Returns expected number of iterations of LOOP, according to
+ measured or guessed profile. No bounding is done on the
+ value. */
+
+gcov_type
+expected_loop_iterations_unbounded (const struct loop *loop)
{
edge e;
edge_iterator ei;
@@ -450,8 +451,7 @@ expected_loop_iterations (const struct loop *loop)
else
expected = (count_latch + count_in - 1) / count_in;
- /* Avoid overflows. */
- return (expected > REG_BR_PROB_BASE ? REG_BR_PROB_BASE : expected);
+ return expected;
}
else
{
@@ -473,6 +473,16 @@ expected_loop_iterations (const struct loop *loop)
}
}
+/* Returns expected number of LOOP iterations. The returned value is bounded
+ by REG_BR_PROB_BASE. */
+
+unsigned
+expected_loop_iterations (const struct loop *loop)
+{
+ gcov_type expected = expected_loop_iterations_unbounded (loop);
+ return (expected > REG_BR_PROB_BASE ? REG_BR_PROB_BASE : expected);
+}
+
/* Returns the maximum level of nesting of subloops of LOOP. */
unsigned