Commit 28af33b0 by Bernd Schmidt Committed by Bernd Schmidt

loop-iv.c (determine_max_iter): New arg OLD_NITER.

	* 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.

From-SVN: r145354
parent 1d1eb80c
...@@ -19,6 +19,10 @@ ...@@ -19,6 +19,10 @@
(LTU (PLUS a C) C) or (LTU (PLUS a C) a) to (GEU a -C); likewise with (LTU (PLUS a C) C) or (LTU (PLUS a C) a) to (GEU a -C); likewise with
GEU/LTU reversed. GEU/LTU reversed.
* 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.
2009-03-31 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com> 2009-03-31 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
PR target/27237 PR target/27237
......
...@@ -2114,10 +2114,13 @@ canonicalize_iv_subregs (struct rtx_iv *iv0, struct rtx_iv *iv1, ...@@ -2114,10 +2114,13 @@ canonicalize_iv_subregs (struct rtx_iv *iv0, struct rtx_iv *iv1,
return true; 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 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 niter = desc->niter_expr;
rtx mmin, mmax, cmp; rtx mmin, mmax, cmp;
...@@ -2152,7 +2155,8 @@ determine_max_iter (struct loop *loop, struct niter_desc *desc) ...@@ -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 /* We could use a binary search here, but for now improving the upper
bound by just one eliminates one important corner case. */ 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); simplify_using_initial_values (loop, UNKNOWN, &cmp);
if (cmp == const_true_rtx) if (cmp == const_true_rtx)
{ {
...@@ -2683,7 +2687,7 @@ iv_number_of_iterations (struct loop *loop, rtx insn, rtx condition, ...@@ -2683,7 +2687,7 @@ iv_number_of_iterations (struct loop *loop, rtx insn, rtx condition,
else else
{ {
if (!desc->niter_max) 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 /* simplify_using_initial_values does a copy propagation on the registers
in the expression for the number of iterations. This prolongs life in the expression for the number of iterations. This prolongs life
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment