diff options
Diffstat (limited to 'gcc/loop-doloop.c')
-rw-r--r-- | gcc/loop-doloop.c | 13 |
1 files changed, 12 insertions, 1 deletions
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); |