diff options
author | Jan Hubicka <jh@suse.cz> | 2012-10-08 20:09:41 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2012-10-08 18:09:41 +0000 |
commit | e3a8f1fa88d6d87444489c5cf8100aeb09bfb179 (patch) | |
tree | eb195a552c62fbc24735e6506d9aa729f6806b75 /gcc/loop-iv.c | |
parent | ee84cd3713c1246afc473ae4acc9b6e061c206fe (diff) | |
download | gcc-e3a8f1fa88d6d87444489c5cf8100aeb09bfb179.zip gcc-e3a8f1fa88d6d87444489c5cf8100aeb09bfb179.tar.gz gcc-e3a8f1fa88d6d87444489c5cf8100aeb09bfb179.tar.bz2 |
loop-unswitch.c (unswitch_single_loop): Use estimated_loop_iterations_int to prevent unswitching when...
* loop-unswitch.c (unswitch_single_loop): Use
estimated_loop_iterations_int to prevent unswitching when loop
is known to not roll.
* tree-ssa-loop-niter.c (estimated_loop_iterations): Do not segfault
when SCEV is not initialized.
(max_loop_iterations): Likewise.
* tree-ssa-loop-unswitch.c (tree_ssa_unswitch_loops): Use
estimated_loop_iterations_int to prevent unswithcing when
loop is known to not roll.
* tree-scalar-evolution.c (scev_initialized_p): New function.
* tree-scalar-evolution.h (scev_initialized_p): Likewise.
* loop-unroll.c (decide_peel_once_rolling): Use
max_loop_iterations_int.
(unroll_loop_constant_iterations): Update
nb_iterations_upper_bound and nb_iterations_estimate.
(decide_unroll_runtime_iterations): Use
estimated_loop_iterations or max_loop_iterations;
(unroll_loop_runtime_iterations): fix profile updating.
(decide_peel_simple): Use estimated_loop_iterations
and max_loop_iterations.
(decide_unroll_stupid): Use estimated_loop_iterations
ad max_loop_iterations.
* loop-doloop.c (doloop_modify): Use max_loop_iterations_int.
(doloop_optimize): Likewise.
* loop-iv.c (iv_number_of_iterations): Use record_niter_bound.
(find_simple_exit): Likewise.
* cfgloop.h (struct niter_desc): Remove niter_max.
From-SVN: r192219
Diffstat (limited to 'gcc/loop-iv.c')
-rw-r--r-- | gcc/loop-iv.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c index e5c7259..658f203 100644 --- a/gcc/loop-iv.c +++ b/gcc/loop-iv.c @@ -2294,10 +2294,6 @@ iv_number_of_iterations (struct loop *loop, rtx insn, rtx condition, desc->const_iter = false; desc->niter_expr = NULL_RTX; - desc->niter_max = 0; - if (loop->any_upper_bound - && loop->nb_iterations_upper_bound.fits_uhwi ()) - desc->niter_max = loop->nb_iterations_upper_bound.low; cond = GET_CODE (condition); gcc_assert (COMPARISON_P (condition)); @@ -2567,9 +2563,8 @@ iv_number_of_iterations (struct loop *loop, rtx insn, rtx condition, ? iv0.base : mode_mmin); max = (up - down) / inc + 1; - if (!desc->niter_max - || max < desc->niter_max) - desc->niter_max = max; + record_niter_bound (loop, double_int::from_shwi (max), + false, true); if (iv0.step == const0_rtx) { @@ -2780,14 +2775,16 @@ iv_number_of_iterations (struct loop *loop, rtx insn, rtx condition, unsigned HOST_WIDEST_INT val = INTVAL (desc->niter_expr); desc->const_iter = true; - desc->niter_max = desc->niter = val & GET_MODE_MASK (desc->mode); + desc->niter = val & GET_MODE_MASK (desc->mode); + record_niter_bound (loop, double_int::from_shwi (desc->niter), + false, true); } else { max = determine_max_iter (loop, desc, old_niter); - if (!desc->niter_max - || max < desc->niter_max) - desc->niter_max = max; + gcc_assert (max); + record_niter_bound (loop, double_int::from_shwi (max), + false, true); /* simplify_using_initial_values does a copy propagation on the registers in the expression for the number of iterations. This prolongs life @@ -2812,7 +2809,8 @@ zero_iter_simplify: zero_iter: desc->const_iter = true; desc->niter = 0; - desc->niter_max = 0; + record_niter_bound (loop, double_int_zero, + true, true); desc->noloop_assumptions = NULL_RTX; desc->niter_expr = const0_rtx; return; @@ -2946,9 +2944,10 @@ find_simple_exit (struct loop *loop, struct niter_desc *desc) print_rtl (dump_file, desc->niter_expr); fprintf (dump_file, "\n"); - fprintf (dump_file, " upper bound: "); - fprintf (dump_file, HOST_WIDEST_INT_PRINT_DEC, desc->niter_max); - fprintf (dump_file, "\n"); + fprintf (dump_file, " upper bound: %li\n", + (long)max_loop_iterations_int (loop)); + fprintf (dump_file, " realistic bound: %li\n", + (long)estimated_loop_iterations_int (loop)); } else fprintf (dump_file, "Loop %d is not simple.\n", loop->num); |