Skip to content

Commit

Permalink
* params.def (PARAM_MAX_ITERATIONS_COMPUTATION_COST): New.
Browse files Browse the repository at this point in the history
	* loop-doloop.c (doloop_optimize): Use it to limit costs of
	expanding the number of iterations.



git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116966 138bc75d-0d04-0410-961f-82ee72b054a4
  • Loading branch information
bernds committed Sep 15, 2006
1 parent e7cfe3d commit 883bb2b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
6 changes: 6 additions & 0 deletions gcc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2005-09-15 Bernd Schmidt <[email protected]>

* params.def (PARAM_MAX_ITERATIONS_COMPUTATION_COST): New.
* loop-doloop.c (doloop_optimize): Use it to limit costs of
expanding the number of iterations.

2006-09-15 Kazu Hirata <[email protected]>

* doc/tm.texi (TARGET_FUNCTION_VALUE): Put @deftypefn all in
Expand Down
13 changes: 12 additions & 1 deletion gcc/loop-doloop.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ doloop_optimize (struct loop *loop)
rtx iterations_max;
rtx start_label;
rtx condition;
unsigned level, est_niter;
unsigned level, est_niter, max_cost;
struct niter_desc *desc;
unsigned word_mode_size;
unsigned HOST_WIDE_INT word_mode_max;
Expand Down Expand Up @@ -525,6 +525,17 @@ doloop_optimize (struct loop *loop)
return false;
}

max_cost
= COSTS_N_INSNS (PARAM_VALUE (PARAM_MAX_ITERATIONS_COMPUTATION_COST));
if (rtx_cost (desc->niter_expr, SET) > max_cost)
{
if (dump_file)
fprintf (dump_file,
"Doloop: number of iterations too costly to compute.\n",
est_niter);
return false;
}

count = copy_rtx (desc->niter_expr);
iterations = desc->const_iter ? desc->niter_expr : const0_rtx;
iterations_max = GEN_INT (desc->niter_max);
Expand Down
6 changes: 6 additions & 0 deletions gcc/params.def
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,12 @@ DEFPARAM(PARAM_MAX_ITERATIONS_TO_TRACK,
"max-iterations-to-track",
"Bound on the number of iterations the brute force # of iterations analysis algorithm evaluates",
1000, 0, 0)
/* A cutoff to avoid costly computations of the number of iterations in
the doloop transformation. */
DEFPARAM(PARAM_MAX_ITERATIONS_COMPUTATION_COST,
"max-iterations-computation-cost",
"Bound on the cost of an expression to compute the number of iterations",
10, 0, 0)

DEFPARAM(PARAM_MAX_SMS_LOOP_NUMBER,
"max-sms-loop-number",
Expand Down

0 comments on commit 883bb2b

Please sign in to comment.