aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfgloopmanip.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2012-10-29 14:25:22 +0000
committerRichard Guenther <rguenther@suse.de>2012-10-29 14:25:22 +0000
commit39ec753df59ac7ebdda9ceea56e9ee333ced30ba (patch)
treecbaaa6dbd01c991e9f8bb98fafc21b063fcdcc02 /gcc/cfgloopmanip.c
parentb3e3752d460b8c27697cd27bc9e23bf338dfbe2b (diff)
2012-10-29 Richard Guenther <rguenther@suse.de>
PR middle-end/53695 * tracer.c (tracer): Fixup loop structure. * cfgloopmanip.c (force_single_succ_latches): Add assert. (fix_loop_structure): Re-compute loop latches and disambiguate loops with multiple latches if required. * gcc.dg/torture/pr53695.c: New testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@192943 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfgloopmanip.c')
-rw-r--r--gcc/cfgloopmanip.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c
index eae68ca43c7..b48e85883ce 100644
--- a/gcc/cfgloopmanip.c
+++ b/gcc/cfgloopmanip.c
@@ -1586,6 +1586,7 @@ force_single_succ_latches (void)
continue;
e = find_edge (loop->latch, loop->header);
+ gcc_checking_assert (e != NULL);
split_edge (e);
}
@@ -1848,6 +1849,32 @@ fix_loop_structure (bitmap changed_bbs)
}
}
+ /* Then re-compute the single latch if there is one. */
+ FOR_EACH_LOOP (li, loop, 0)
+ {
+ edge_iterator ei;
+ edge e, latch = NULL;
+ FOR_EACH_EDGE (e, ei, loop->header->preds)
+ if (dominated_by_p (CDI_DOMINATORS, e->src, loop->header))
+ {
+ if (!latch)
+ latch = e;
+ else
+ {
+ latch = NULL;
+ break;
+ }
+ }
+ if (latch
+ && latch->src->loop_father == loop)
+ loop->latch = latch->src;
+ else
+ loop->latch = NULL;
+ }
+
+ if (!loops_state_satisfies_p (LOOPS_MAY_HAVE_MULTIPLE_LATCHES))
+ disambiguate_loops_with_multiple_latches ();
+
if (loops_state_satisfies_p (LOOPS_HAVE_PREHEADERS))
create_preheaders (CP_SIMPLE_PREHEADERS);