diff options
author | bernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-03-31 15:21:30 +0000 |
---|---|---|
committer | bernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-03-31 15:21:30 +0000 |
commit | f77c1bb01b175cdd966d3d79ec4c174f017f2610 (patch) | |
tree | 4ce5df489c1a18e936be58bd5d8dd2be412323bd /gcc/loop-iv.c | |
parent | d2cb78ca7b60bd3c3e4b7febdae2ee3f0c9ea70d (diff) | |
download | gcc-f77c1bb01b175cdd966d3d79ec4c174f017f2610.tar.gz |
* loop-iv.c (determine_max_iter): New arg OLD_NITER. All callers
changed. Use this when trying to improve the upper bound.
Generate the comparison by using simplify_gen_relational.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@145354 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/loop-iv.c')
-rw-r--r-- | gcc/loop-iv.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c index 123e37cff59..9b35b888210 100644 --- a/gcc/loop-iv.c +++ b/gcc/loop-iv.c @@ -2114,10 +2114,13 @@ canonicalize_iv_subregs (struct rtx_iv *iv0, struct rtx_iv *iv1, return true; } -/* Tries to estimate the maximum number of iterations. */ +/* Tries to estimate the maximum number of iterations in LOOP, and store the + result in DESC. This function is called from iv_number_of_iterations with + a number of fields in DESC already filled in. OLD_NITER is the original + expression for the number of iterations, before we tried to simplify it. */ static unsigned HOST_WIDEST_INT -determine_max_iter (struct loop *loop, struct niter_desc *desc) +determine_max_iter (struct loop *loop, struct niter_desc *desc, rtx old_niter) { rtx niter = desc->niter_expr; rtx mmin, mmax, cmp; @@ -2152,7 +2155,8 @@ determine_max_iter (struct loop *loop, struct niter_desc *desc) /* We could use a binary search here, but for now improving the upper bound by just one eliminates one important corner case. */ - cmp = gen_rtx_fmt_ee (desc->signed_p ? LT : LTU, VOIDmode, niter, mmax); + cmp = simplify_gen_relational (desc->signed_p ? LT : LTU, VOIDmode, + desc->mode, old_niter, mmax); simplify_using_initial_values (loop, UNKNOWN, &cmp); if (cmp == const_true_rtx) { @@ -2683,7 +2687,7 @@ iv_number_of_iterations (struct loop *loop, rtx insn, rtx condition, else { if (!desc->niter_max) - desc->niter_max = determine_max_iter (loop, desc); + desc->niter_max = determine_max_iter (loop, desc, old_niter); /* simplify_using_initial_values does a copy propagation on the registers in the expression for the number of iterations. This prolongs life |