summaryrefslogtreecommitdiff
path: root/gcc/cfgloopmanip.c
diff options
context:
space:
mode:
authorZdenek Dvorak <dvorakz@suse.cz>2006-12-20 15:15:53 +0100
committerZdenek Dvorak <rakdver@gcc.gnu.org>2006-12-20 14:15:53 +0000
commitee8c1b05d53213625231c9df895501823b19d44c (patch)
treec833734dce382efda016f8ef594a2fe91177e6ef /gcc/cfgloopmanip.c
parentc882a2c2384d367d612ab1ce12030d6900d216c9 (diff)
downloadgcc-ee8c1b05d53213625231c9df895501823b19d44c.tar.gz
loop-unswitch.c (unswitch_loop): Update arguments of duplicate_loop_to_header_edge call.
* loop-unswitch.c (unswitch_loop): Update arguments of duplicate_loop_to_header_edge call. * tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Ditto. * loop-unroll.c (peel_loop_completely, unroll_loop_constant_iterations, unroll_loop_runtime_iterations, peel_loop_simple, unroll_loop_stupid): Ditto. * cfgloopmanip.c (loop_version): Ditto. (duplicate_loop_to_header_edge): Change type of to_remove to VEC(edge), remove n_to_remove argument. * tree-ssa-loop-manip.c (tree_duplicate_loop_to_header_edge): Change type of to_remove to VEC(edge), remove n_to_remove argument. (tree_unroll_loop): Update arguments of tree_duplicate_loop_to_header_edge call. * cfghooks.c (cfg_hook_duplicate_loop_to_header_edge): Change type of to_remove to VEC(edge), remove n_to_remove argument. * cfghooks.h (struct cfg_hooks): Type of cfg_hook_duplicate_loop_to_header_edge changed. (cfg_hook_duplicate_loop_to_header_edge): Declaration changed. * cfgloop.h (duplicate_loop_to_header_edge): Ditto. * tree-flow.h (tree_duplicate_loop_to_header_edge): Ditto. From-SVN: r120074
Diffstat (limited to 'gcc/cfgloopmanip.c')
-rw-r--r--gcc/cfgloopmanip.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c
index 83d4e4c0e13..9021fbafd4e 100644
--- a/gcc/cfgloopmanip.c
+++ b/gcc/cfgloopmanip.c
@@ -814,11 +814,12 @@ update_single_exit_for_duplicated_loops (struct loop *orig_loops[], unsigned n)
original LOOP body, the other copies are numbered in order given by control
flow through them) into TO_REMOVE array. Returns false if duplication is
impossible. */
+
bool
duplicate_loop_to_header_edge (struct loop *loop, edge e,
unsigned int ndupl, sbitmap wont_exit,
- edge orig, edge *to_remove,
- unsigned int *n_to_remove, int flags)
+ edge orig, VEC (edge, heap) **to_remove,
+ int flags)
{
struct loop *target, *aloop;
struct loop **orig_loops;
@@ -966,10 +967,6 @@ duplicate_loop_to_header_edge (struct loop *loop, edge e,
if (current_loops->state & LOOPS_HAVE_MARKED_SINGLE_EXITS)
update_single_exits_after_duplication (bbs, n, target);
- /* Record exit edge in original loop body. */
- if (orig && TEST_BIT (wont_exit, 0))
- to_remove[(*n_to_remove)++] = orig;
-
spec_edges[SE_ORIG] = orig;
spec_edges[SE_LATCH] = latch_edge;
@@ -1043,7 +1040,10 @@ duplicate_loop_to_header_edge (struct loop *loop, edge e,
/* Record exit edge in this copy. */
if (orig && TEST_BIT (wont_exit, j + 1))
- to_remove[(*n_to_remove)++] = new_spec_edges[SE_ORIG];
+ {
+ if (to_remove)
+ VEC_safe_push (edge, heap, *to_remove, new_spec_edges[SE_ORIG]);
+ }
/* Record the first copy in the control flow order if it is not
the original loop (i.e. in case of peeling). */
@@ -1063,6 +1063,13 @@ duplicate_loop_to_header_edge (struct loop *loop, edge e,
free (new_bbs);
free (orig_loops);
+ /* Record the exit edge in the original loop body, and update the frequencies. */
+ if (orig && TEST_BIT (wont_exit, 0))
+ {
+ if (to_remove)
+ VEC_safe_push (edge, heap, *to_remove, orig);
+ }
+
/* Update the original loop. */
if (!is_latch)
set_immediate_dominator (CDI_DOMINATORS, e->dest, e->src);
@@ -1302,7 +1309,7 @@ loop_version (struct loop *loop,
/* Duplicate loop. */
if (!cfg_hook_duplicate_loop_to_header_edge (loop, entry, 1,
- NULL, NULL, NULL, NULL, 0))
+ NULL, NULL, NULL, 0))
return NULL;
/* After duplication entry edge now points to new loop head block.