diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-03-30 14:30:57 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-03-30 14:30:57 +0000 |
commit | ef4f1cb3fc53b59947f28908653d2bfb4cc62445 (patch) | |
tree | 2c2462790bd07263fc7a94de1236e8fb1f73b78d | |
parent | 932c0baa8e3db9ef77b71312e5b1a7241ef5258d (diff) | |
download | gcc-ef4f1cb3fc53b59947f28908653d2bfb4cc62445.tar.gz |
* tree-ssa-loop-niter.c (idx_infer_loop_bounds): We can't get realistic
estimates here.
* tree-ssa-loop-unswitch.c (tree_unswitch_single_loop): Use also
max_loop_iterations_int.
(tree_unswitch_outer_loop): Likewise.
* tree-ssa-loop-ivopts.c (avg_loop_niter): Likewise.
* tree-vect-loop.c (vect_analyze_loop_2): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234572 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/tree-ssa-loop-ivopts.c | 6 | ||||
-rw-r--r-- | gcc/tree-ssa-loop-niter.c | 9 | ||||
-rw-r--r-- | gcc/tree-ssa-loop-unswitch.c | 4 | ||||
-rw-r--r-- | gcc/tree-vect-loop.c | 2 |
5 files changed, 25 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 35af4ecac72..9e4e0acfe2b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2016-03-30 Jan Hubicka <hubicka@ucw.cz> + + * tree-ssa-loop-niter.c (idx_infer_loop_bounds): We can't get realistic + estimates here. + * tree-ssa-loop-unswitch.c (tree_unswitch_single_loop): Use also + max_loop_iterations_int. + (tree_unswitch_outer_loop): Likewise. + * tree-ssa-loop-ivopts.c (avg_loop_niter): Likewise. + * tree-vect-loop.c (vect_analyze_loop_2): Likewise. + 2016-03-30 Richard Biener <rguenther@suse.de> PR middle-end/70450 diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index 99dd4d0b7ec..29c4ba4cf56 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -121,7 +121,11 @@ avg_loop_niter (struct loop *loop) { HOST_WIDE_INT niter = estimated_stmt_executions_int (loop); if (niter == -1) - return AVG_LOOP_NITER (loop); + { + niter = max_stmt_executions_int (loop); + if (niter == -1 || niter > AVG_LOOP_NITER (loop)) + return AVG_LOOP_NITER (loop); + } return niter; } diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index 81689fc1aa4..c93e563e51c 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -3115,7 +3115,6 @@ idx_infer_loop_bounds (tree base, tree *idx, void *dta) tree low, high, type, next; bool sign, upper = true, at_end = false; struct loop *loop = data->loop; - bool reliable = true; if (TREE_CODE (base) != ARRAY_REF) return true; @@ -3187,14 +3186,14 @@ idx_infer_loop_bounds (tree base, tree *idx, void *dta) && tree_int_cst_compare (next, high) <= 0) return true; - /* If access is not executed on every iteration, we must ensure that overlow may - not make the access valid later. */ + /* If access is not executed on every iteration, we must ensure that overlow + may not make the access valid later. */ if (!dominated_by_p (CDI_DOMINATORS, loop->latch, gimple_bb (data->stmt)) && scev_probably_wraps_p (initial_condition_in_loop_num (ev, loop->num), step, data->stmt, loop, true)) - reliable = false; + upper = false; - record_nonwrapping_iv (loop, init, step, data->stmt, low, high, reliable, upper); + record_nonwrapping_iv (loop, init, step, data->stmt, low, high, false, upper); return true; } diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c index dd6fd01256a..77acd66e997 100644 --- a/gcc/tree-ssa-loop-unswitch.c +++ b/gcc/tree-ssa-loop-unswitch.c @@ -223,6 +223,8 @@ tree_unswitch_single_loop (struct loop *loop, int num) /* If the loop is not expected to iterate, there is no need for unswitching. */ iterations = estimated_loop_iterations_int (loop); + if (iterations < 0) + iterations = max_loop_iterations_int (loop); if (iterations >= 0 && iterations <= 1) { if (dump_file && (dump_flags & TDF_DETAILS)) @@ -439,6 +441,8 @@ tree_unswitch_outer_loop (struct loop *loop) /* If the loop is not expected to iterate, there is no need for unswitching. */ iterations = estimated_loop_iterations_int (loop); + if (iterations < 0) + iterations = max_loop_iterations_int (loop); if (iterations >= 0 && iterations <= 1) { if (dump_file && (dump_flags & TDF_DETAILS)) diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index d813b862592..f977ee9351b 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -2063,6 +2063,8 @@ start_over: estimated_niter = estimated_stmt_executions_int (LOOP_VINFO_LOOP (loop_vinfo)); + if (estimated_niter != -1) + estimated_niter = max_niter; if (estimated_niter != -1 && ((unsigned HOST_WIDE_INT) estimated_niter <= MAX (th, (unsigned)min_profitable_estimate))) |