diff options
author | pthaugen <pthaugen@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-11-10 18:55:57 +0000 |
---|---|---|
committer | pthaugen <pthaugen@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-11-10 18:55:57 +0000 |
commit | b851b8f04b8b40b6ffff62c279979abe1399e5ac (patch) | |
tree | 223b62a9c66bd4b015116cdb4548e792f4fe43a6 /gcc/loop-unroll.c | |
parent | e98fc15a2ffde0b206fc9a9c1458cc9bb2d4607b (diff) | |
download | gcc-b851b8f04b8b40b6ffff62c279979abe1399e5ac.tar.gz |
PR rtl-optimization/78241
* loop-unroll.c (unroll_loop_runtime_iterations): Don't adjust 'niter', but
emit initial peel copy if niter expr is not reliable.
* gcc.dg/pr78241.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@242047 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/loop-unroll.c')
-rw-r--r-- | gcc/loop-unroll.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c index 91118a310d0..760445e6448 100644 --- a/gcc/loop-unroll.c +++ b/gcc/loop-unroll.c @@ -918,9 +918,10 @@ unroll_loop_runtime_iterations (struct loop *loop) if (tmp != niter) emit_move_insn (niter, tmp); - /* For loops that exit at end, add one to niter to account for first pass - through loop body before reaching exit test. */ - if (exit_at_end) + /* For loops that exit at end and whose number of iterations is reliable, + add one to niter to account for first pass through loop body before + reaching exit test. */ + if (exit_at_end && !desc->noloop_assumptions) { niter = expand_simple_binop (desc->mode, PLUS, niter, const1_rtx, @@ -946,7 +947,7 @@ unroll_loop_runtime_iterations (struct loop *loop) auto_sbitmap wont_exit (max_unroll + 2); - if (extra_zero_check) + if (extra_zero_check || desc->noloop_assumptions) { /* Peel the first copy of loop body. Leave the exit test if the number of iterations is not reliable. Also record the place of the extra zero |