summaryrefslogtreecommitdiff
path: root/gcc/cfgloopmanip.c
diff options
context:
space:
mode:
authorrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2006-11-12 18:20:03 +0000
committerrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2006-11-12 18:20:03 +0000
commit56743459ef01d1123da77ce237b73dfbfd49badd (patch)
tree8d48fdb7d07dc37f4d2f16a51dc3192fbda851c1 /gcc/cfgloopmanip.c
parentd71e17011aefd0cd454a9984a026cd1a3c2f40d6 (diff)
downloadgcc-56743459ef01d1123da77ce237b73dfbfd49badd.tar.gz
* cfgloopmanip.c (update_single_exit_for_duplicated_loop,
update_single_exit_for_duplicated_loops): New functions. (duplicate_loop_to_header_edge): Use update_single_exit_for_duplicated_loops. * tree-ssa-loop-manip.c (tree_unroll_loop): Call verification functions only with ENABLE_CHECKING. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@118726 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfgloopmanip.c')
-rw-r--r--gcc/cfgloopmanip.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c
index 1ef65143d44..8c5a0f14a58 100644
--- a/gcc/cfgloopmanip.c
+++ b/gcc/cfgloopmanip.c
@@ -770,6 +770,40 @@ update_single_exits_after_duplication (basic_block *bbs, unsigned nbbs,
bbs[i]->flags &= ~BB_DUPLICATED;
}
+/* Updates single exit information for the copy of LOOP. */
+
+static void
+update_single_exit_for_duplicated_loop (struct loop *loop)
+{
+ struct loop *copy = loop->copy;
+ basic_block src, dest;
+ edge exit = loop->single_exit;
+
+ if (!exit)
+ return;
+
+ src = get_bb_copy (exit->src);
+ dest = exit->dest;
+ if (dest->flags & BB_DUPLICATED)
+ dest = get_bb_copy (dest);
+
+ exit = find_edge (src, dest);
+ gcc_assert (exit != NULL);
+ copy->single_exit = exit;
+}
+
+/* Updates single exit information for copies of ORIG_LOOPS and their subloops.
+ N is the number of the loops in the ORIG_LOOPS array. */
+
+static void
+update_single_exit_for_duplicated_loops (struct loop *orig_loops[], unsigned n)
+{
+ unsigned i;
+
+ for (i = 0; i < n; i++)
+ update_single_exit_for_duplicated_loop (orig_loops[i]);
+}
+
/* Duplicates body of LOOP to given edge E NDUPL times. Takes care of updating
LOOPS structure and dominators. E's destination must be LOOP header for
this to work, i.e. it must be entry or latch edge of this loop; these are
@@ -950,6 +984,15 @@ duplicate_loop_to_header_edge (struct loop *loop, edge e, struct loops *loops,
place_after);
place_after = new_spec_edges[SE_LATCH]->src;
+ if (loops->state & LOOPS_HAVE_MARKED_SINGLE_EXITS)
+ {
+ for (i = 0; i < n; i++)
+ bbs[i]->flags |= BB_DUPLICATED;
+ update_single_exit_for_duplicated_loops (orig_loops, n_orig_loops);
+ for (i = 0; i < n; i++)
+ bbs[i]->flags &= ~BB_DUPLICATED;
+ }
+
if (flags & DLTHE_RECORD_COPY_NUMBER)
for (i = 0; i < n; i++)
{