diff options
author | Jan Hubicka <jh@suse.cz> | 2005-08-03 15:34:49 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2005-08-03 13:34:49 +0000 |
commit | 178df94ff18a589455749496b4cd6888feb567b0 (patch) | |
tree | 1a926b9bc202452ffb1c89f9db59da5c72ea357e /gcc/tree-ssa-loop-ivcanon.c | |
parent | 4164b2fb1628493c3b529b1e9ee045a504f44a0e (diff) | |
download | gcc-178df94ff18a589455749496b4cd6888feb567b0.zip gcc-178df94ff18a589455749496b4cd6888feb567b0.tar.gz gcc-178df94ff18a589455749496b4cd6888feb567b0.tar.bz2 |
cfgloop.h (DLTHE_FLAG_COMPLETTE_PEEL): New flag.
* cfgloop.h (DLTHE_FLAG_COMPLETTE_PEEL): New flag.
* cfgloopmanip.c (duplicate_loop_to_header_edge): Special case
profile updating for complette unrolling.
* loop-unroll.c (peel_loop_completely): Use it.
* tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Likewise.
(tree_unroll_loops_completely): Disable code growing unrolling of cold
loops.
* update-conroll.c: New testcase.
* update-conroll-2.c: New testcase.
From-SVN: r102687
Diffstat (limited to 'gcc/tree-ssa-loop-ivcanon.c')
-rw-r--r-- | gcc/tree-ssa-loop-ivcanon.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c index e8a94d6..4ac2003 100644 --- a/gcc/tree-ssa-loop-ivcanon.c +++ b/gcc/tree-ssa-loop-ivcanon.c @@ -223,20 +223,35 @@ try_unroll_loop_completely (struct loops *loops ATTRIBUTE_UNUSED, if (n_unroll) { + sbitmap wont_exit; + edge *edges_to_remove = xmalloc (sizeof (edge *) * n_unroll); + unsigned int n_to_remove = 0; + old_cond = COND_EXPR_COND (cond); COND_EXPR_COND (cond) = dont_exit; update_stmt (cond); initialize_original_copy_tables (); + wont_exit = sbitmap_alloc (n_unroll + 1); + sbitmap_ones (wont_exit); + RESET_BIT (wont_exit, 0); + if (!tree_duplicate_loop_to_header_edge (loop, loop_preheader_edge (loop), - loops, n_unroll, NULL, - NULL, NULL, NULL, 0)) + loops, n_unroll, wont_exit, + exit, edges_to_remove, + &n_to_remove, + DLTHE_FLAG_UPDATE_FREQ + | DLTHE_FLAG_COMPLETTE_PEEL)) { COND_EXPR_COND (cond) = old_cond; update_stmt (cond); free_original_copy_tables (); + free (wont_exit); + free (edges_to_remove); return false; } + free (wont_exit); + free (edges_to_remove); free_original_copy_tables (); } @@ -350,7 +365,7 @@ tree_unroll_loops_completely (struct loops *loops, bool may_increase_size) unsigned i; struct loop *loop; bool changed = false; - enum unroll_level ul = may_increase_size ? UL_ALL : UL_NO_GROWTH; + enum unroll_level ul; for (i = 1; i < loops->num; i++) { @@ -359,6 +374,10 @@ tree_unroll_loops_completely (struct loops *loops, bool may_increase_size) if (!loop) continue; + if (may_increase_size && maybe_hot_bb_p (loop->header)) + ul = UL_ALL; + else + ul = UL_NO_GROWTH; changed |= canonicalize_loop_induction_variables (loops, loop, false, ul, !flag_tree_loop_ivcanon); |