diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-08-03 13:34:49 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-08-03 13:34:49 +0000 |
commit | fb54ef7ccb98fc1c10a1662869dab0a3ab52a35a (patch) | |
tree | 1a926b9bc202452ffb1c89f9db59da5c72ea357e /gcc/tree-ssa-loop-ivcanon.c | |
parent | 136305f40bec39c518bec801bcb454cf483005f3 (diff) | |
download | gcc-fb54ef7ccb98fc1c10a1662869dab0a3ab52a35a.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@102687 138bc75d-0d04-0410-961f-82ee72b054a4
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 e8a94d66e6c..4ac20039f4c 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); |