aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-data-ref.c
diff options
context:
space:
mode:
authorZdenek Dvorak <dvorakz@suse.cz>2007-03-16 01:25:30 +0100
committerZdenek Dvorak <rakdver@gcc.gnu.org>2007-03-16 00:25:30 +0000
commit9bdb685eda8fc13f43450520b257fa1bfe3e464e (patch)
tree5428421105c29c278a57087c665dc954fb95d826 /gcc/tree-data-ref.c
parentd4daf0d62328911ad4ba572a3e332a39abfb4096 (diff)
downloadgcc-9bdb685eda8fc13f43450520b257fa1bfe3e464e.zip
gcc-9bdb685eda8fc13f43450520b257fa1bfe3e464e.tar.gz
gcc-9bdb685eda8fc13f43450520b257fa1bfe3e464e.tar.bz2
tree-ssa-loop-niter.c (record_estimate): Add "upper" argument.
* tree-ssa-loop-niter.c (record_estimate): Add "upper" argument. Update constant estimates of number of iterations. (record_nonwrapping_iv): Add "upper" argument. "data_size_bounds_p" argument renamed to "realistic". (compute_estimated_nb_iterations): Removed. (record_niter_bound): New function. (idx_infer_loop_bounds): For possible but unlikely tail arrays, call record_nonwrapping_iv with upper = false. (infer_loop_bounds_from_signedness): Pass upper argument to record_nonwrapping_iv. (estimate_numbers_of_iterations_loop): Do not call compute_estimated_nb_iterations. Record estimate based on profile information. Initialize the constant estimates of number of iterations. * tree-data-ref.c (estimated_loop_iterations): Return the recorded estimates. * tree-ssa-loop-prefetch.c (loop_prefetch_arrays): Add dump when number of iterations is too small. * cfgloop.h (struct nb_iter_bound): Remove "realistic" field. (EST_NOT_AVAILABLE): Removed. (struct loop): Replace estimated_nb_iterations by any_upper_bound, nb_iterations_upper_bound, any_estimate and nb_iterations_estimate fields. * gcc.dg/tree-ssa/prefetch-5.c: New test. From-SVN: r122969
Diffstat (limited to 'gcc/tree-data-ref.c')
-rw-r--r--gcc/tree-data-ref.c32
1 files changed, 11 insertions, 21 deletions
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index d59278c..01bb71b 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -2556,33 +2556,23 @@ static bool
estimated_loop_iterations (struct loop *loop, bool conservative,
double_int *nit)
{
- tree numiter = number_of_exit_cond_executions (loop);
-
- /* If we have an exact value, use it. */
- if (TREE_CODE (numiter) == INTEGER_CST)
+ estimate_numbers_of_iterations_loop (loop);
+ if (conservative)
{
- *nit = tree_to_double_int (numiter);
- return true;
- }
+ if (!loop->any_upper_bound)
+ return false;
- /* If we have a measured profile and we do not ask for a conservative bound,
- use it. */
- if (!conservative && loop->header->count != 0)
- {
- *nit = uhwi_to_double_int (expected_loop_iterations (loop) + 1);
- return true;
+ *nit = loop->nb_iterations_upper_bound;
}
-
- /* Finally, try using a reliable estimate on number of iterations according
- to the size of the accessed data, if available. */
- estimate_numbers_of_iterations_loop (loop);
- if (loop->estimate_state == EST_AVAILABLE)
+ else
{
- *nit = loop->estimated_nb_iterations;
- return true;
+ if (!loop->any_estimate)
+ return false;
+
+ *nit = loop->nb_iterations_estimate;
}
- return false;
+ return true;
}
/* Similar to estimated_loop_iterations, but returns the estimate only