diff options
author | Richard Guenther <rguenther@suse.de> | 2012-04-19 08:51:50 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2012-04-19 08:51:50 +0000 |
commit | daa573866d655917328caec7debf2175e2a566f8 (patch) | |
tree | 92d23c442fd6840815fd73d552e519a3d4bac434 /gcc/loop-unroll.c | |
parent | 1295401bcf45076d15e73746dd52ed2127d47588 (diff) | |
download | gcc-daa573866d655917328caec7debf2175e2a566f8.zip gcc-daa573866d655917328caec7debf2175e2a566f8.tar.gz gcc-daa573866d655917328caec7debf2175e2a566f8.tar.bz2 |
re PR tree-optimization/44688 (Excessive code-size growth at -O3)
2012-04-19 Richard Guenther <rguenther@suse.de>
PR rtl-optimization/44688
* loop-iv.c (determine_max_iter): Only return max_iter.
(iv_number_of_iterations): Also use the recorded loop bound
on the maximum number of iterations.
* loop-unroll.c (decide_unroll_runtime_iterations): Use
max_iter to avoid unrolling loops that do not roll.
(decide_unroll_stupid): Likewise.
* gcc.dg/var-expand1.c: Increase array size to make unrolling
possibly profitable.
From-SVN: r186585
Diffstat (limited to 'gcc/loop-unroll.c')
-rw-r--r-- | gcc/loop-unroll.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c index 5a658d8..f251f5d 100644 --- a/gcc/loop-unroll.c +++ b/gcc/loop-unroll.c @@ -857,7 +857,9 @@ decide_unroll_runtime_iterations (struct loop *loop, int flags) } /* If we have profile feedback, check whether the loop rolls. */ - if (loop->header->count && expected_loop_iterations (loop) < 2 * nunroll) + if ((loop->header->count + && expected_loop_iterations (loop) < 2 * nunroll) + || desc->niter_max < 2 * nunroll) { if (dump_file) fprintf (dump_file, ";; Not unrolling loop, doesn't roll\n"); @@ -1400,8 +1402,9 @@ decide_unroll_stupid (struct loop *loop, int flags) } /* If we have profile feedback, check whether the loop rolls. */ - if (loop->header->count - && expected_loop_iterations (loop) < 2 * nunroll) + if ((loop->header->count + && expected_loop_iterations (loop) < 2 * nunroll) + || desc->niter_max < 2 * nunroll) { if (dump_file) fprintf (dump_file, ";; Not unrolling loop, doesn't roll\n"); |