diff options
author | Bin Cheng <bin.cheng@arm.com> | 2016-07-29 15:44:00 +0000 |
---|---|---|
committer | Bin Cheng <amker@gcc.gnu.org> | 2016-07-29 15:44:00 +0000 |
commit | 18767ebc32eaed40760aab394fe77d0815454efd (patch) | |
tree | a1a32cebdc504645bd7b6aa9f95e65a49b16c9a7 /gcc/tree-ssa-loop-niter.c | |
parent | f6c7a248d5eb50e3cfcf15e552c2be698ebea34b (diff) | |
download | gcc-18767ebc32eaed40760aab394fe77d0815454efd.zip gcc-18767ebc32eaed40760aab394fe77d0815454efd.tar.gz gcc-18767ebc32eaed40760aab394fe77d0815454efd.tar.bz2 |
cfgloop.h (struct loop): New field constraints.
* cfgloop.h (struct loop): New field constraints.
(LOOP_C_INFINITE, LOOP_C_FINITE): New macros.
(loop_constraint_set, loop_constraint_clr, loop_constraint_set_p): New
functions.
* cfgloop.c (alloc_loop): Initialize new field.
* cfgloopmanip.c (copy_loop_info): Copy constraints.
* tree-ssa-loop-niter.c (number_of_iterations_exit_assumptions):
Adjust niter analysis wrto loop constraints.
* doc/loop.texi (@node Number of iterations): Add description for loop
constraints.
From-SVN: r238876
Diffstat (limited to 'gcc/tree-ssa-loop-niter.c')
-rw-r--r-- | gcc/tree-ssa-loop-niter.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index 95bb5cf..191a071 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -2151,6 +2151,10 @@ number_of_iterations_exit_assumptions (struct loop *loop, edge exit, affine_iv iv0, iv1; bool safe; + /* Nothing to analyze if the loop is known to be infinite. */ + if (loop_constraint_set_p (loop, LOOP_C_INFINITE)) + return false; + safe = dominated_by_p (CDI_DOMINATORS, loop->latch, exit->src); if (every_iteration && !safe) @@ -2236,6 +2240,11 @@ number_of_iterations_exit_assumptions (struct loop *loop, edge exit, niter->max = wi::to_widest (iv_niters); } + /* There is no assumptions if the loop is known to be finite. */ + if (!integer_zerop (niter->assumptions) + && loop_constraint_set_p (loop, LOOP_C_FINITE)) + niter->assumptions = boolean_true_node; + if (optimize >= 3) { niter->assumptions = simplify_using_outer_evolutions (loop, |