aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernd Schmidt <bernd.schmidt@analog.com>2006-09-15 11:17:18 +0000
committerBernd Schmidt <bernds@gcc.gnu.org>2006-09-15 11:17:18 +0000
commit45b9a14bd655c1526f66a5b4e88e16a290ea01c9 (patch)
tree760d109441f8836d466cfee8c2c84acab7dcf3e4
parent21cc37194e7036e89ac7823a78539056fc802dbb (diff)
downloadgcc-45b9a14bd655c1526f66a5b4e88e16a290ea01c9.zip
gcc-45b9a14bd655c1526f66a5b4e88e16a290ea01c9.tar.gz
gcc-45b9a14bd655c1526f66a5b4e88e16a290ea01c9.tar.bz2
params.def (PARAM_MAX_ITERATIONS_COMPUTATION_COST): New.
* params.def (PARAM_MAX_ITERATIONS_COMPUTATION_COST): New. * loop-doloop.c (doloop_optimize): Use it to limit costs of expanding the number of iterations. From-SVN: r116966
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/loop-doloop.c13
-rw-r--r--gcc/params.def6
3 files changed, 24 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 254b64a..51594ac 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2005-09-15 Bernd Schmidt <bernd.schmidt@analog.com>
+
+ * 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 <kazu@codesourcery.com>
* doc/tm.texi (TARGET_FUNCTION_VALUE): Put @deftypefn all in
diff --git a/gcc/loop-doloop.c b/gcc/loop-doloop.c
index f63e342..f2bb9ba 100644
--- a/gcc/loop-doloop.c
+++ b/gcc/loop-doloop.c
@@ -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;
@@ -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);
diff --git a/gcc/params.def b/gcc/params.def
index 6d230fc..488a4a9 100644
--- a/gcc/params.def
+++ b/gcc/params.def
@@ -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",