From 9b53b827289cc54936d2b9a28ba238ab584df88c Mon Sep 17 00:00:00 2001 From: rguenth Date: Wed, 1 Sep 2010 11:39:55 +0000 Subject: 2010-09-01 Richard Guenther * tree-vrp.c (adjust_range_with_scev): Use number of iteration estimate. (vrp_visit_phi_node): Delay using SCEV till we balloon the range. (execute_vrp): Compute number of iteration estimates. * cfgloop.h (estimate_numbers_of_iterations_loop): Adjust prototype. * tree-flow.h (estimate_numbers_of_iterations): Likewise. * tree-data-ref.c (estimated_loop_iterations): Adjust. * tree-ssa-loop-niter.c (estimate_numbers_of_iterations_loop): Infer loop bounds from undefined behavior based on a new parameter. (estimate_numbers_of_iterations): Likewise. (scev_probably_wraps_p): Adjust. * tree-ssa-loop.c (tree_ssa_loop_bounds): Likewise. * gcc.dg/vect/vect-outer-fir.c: Adjust. * gcc.dg/tree-ssa/vrp54.c: New testcase. * gcc.c-torture/execute/20100827-1.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163724 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-loop-niter.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'gcc/tree-ssa-loop-niter.c') diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index 2118b973a63..94d150d8246 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -2933,10 +2933,11 @@ gcov_type_to_double_int (gcov_type val) return ret; } -/* Records estimates on numbers of iterations of LOOP. */ +/* Records estimates on numbers of iterations of LOOP. If USE_UNDEFINED_P + is true also use estimates derived from undefined behavior. */ void -estimate_numbers_of_iterations_loop (struct loop *loop) +estimate_numbers_of_iterations_loop (struct loop *loop, bool use_undefined_p) { VEC (edge, heap) *exits; tree niter, type; @@ -2970,7 +2971,8 @@ estimate_numbers_of_iterations_loop (struct loop *loop) } VEC_free (edge, heap, exits); - infer_loop_bounds_from_undefined (loop); + if (use_undefined_p) + infer_loop_bounds_from_undefined (loop); /* If we have a measured profile, use it to estimate the number of iterations. */ @@ -2993,7 +2995,7 @@ estimate_numbers_of_iterations_loop (struct loop *loop) /* Records estimates on numbers of iterations of loops. */ void -estimate_numbers_of_iterations (void) +estimate_numbers_of_iterations (bool use_undefined_p) { loop_iterator li; struct loop *loop; @@ -3004,7 +3006,7 @@ estimate_numbers_of_iterations (void) FOR_EACH_LOOP (li, loop, 0) { - estimate_numbers_of_iterations_loop (loop); + estimate_numbers_of_iterations_loop (loop, use_undefined_p); } fold_undefer_and_ignore_overflow_warnings (); @@ -3200,7 +3202,7 @@ scev_probably_wraps_p (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 (loop, true); for (bound = loop->bounds; bound; bound = bound->next) { if (n_of_executions_at_most (at_stmt, bound, valid_niter)) -- cgit v1.2.3