From 7276921760f1b9a8ec3e6f34644c1399dff1b9b1 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 21 Nov 2013 09:15:38 +0000 Subject: [PATCH] tree-ssa-loop-ch.c (copy_loop_headers): Decrement nb_iterations_upper_bound by one. 2013-11-21 Richard Biener * tree-ssa-loop-ch.c (copy_loop_headers): Decrement nb_iterations_upper_bound by one. From-SVN: r205198 --- gcc/ChangeLog | 5 +++++ gcc/tree-ssa-loop-ch.c | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1cfbefef29d..1ececafc827 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2013-11-21 Richard Biener + + * tree-ssa-loop-ch.c (copy_loop_headers): Decrement + nb_iterations_upper_bound by one. + 2013-11-21 Richard Biener PR tree-optimization/59058 diff --git a/gcc/tree-ssa-loop-ch.c b/gcc/tree-ssa-loop-ch.c index df45c286790..ccaa9c8987e 100644 --- a/gcc/tree-ssa-loop-ch.c +++ b/gcc/tree-ssa-loop-ch.c @@ -243,6 +243,16 @@ copy_loop_headers (void) are not now, since there was the loop exit condition. */ split_edge (loop_preheader_edge (loop)); split_edge (loop_latch_edge (loop)); + + /* We peeled off one iteration of the loop thus we can lower + the maximum number of iterations if we have a previously + recorded value for that. */ + double_int max; + if (get_max_loop_iterations (loop, &max)) + { + max -= double_int_one; + loop->nb_iterations_upper_bound = max; + } } update_ssa (TODO_update_ssa);