summaryrefslogtreecommitdiffstats
path: root/gcc/cfgloop.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2013-02-18 13:03:15 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2013-02-18 13:03:15 +0000
commitb375c775b913eba47902f2f0aed89f4e2e22759c (patch)
treefa9d3fe97ade8428e04dda97cbfe0aa6c5a1329e /gcc/cfgloop.c
parente6b37e57d7cd38d9ce2553e47e6c702d0d9f492a (diff)
downloadppe42-gcc-b375c775b913eba47902f2f0aed89f4e2e22759c.tar.gz
ppe42-gcc-b375c775b913eba47902f2f0aed89f4e2e22759c.zip
2013-02-18 Richard Biener <rguenther@suse.de>
PR middle-end/56350 * cfghooks.c (merge_blocks): If we merge a latch into another block adjust references to it. * cfgloop.c (flow_loops_find): Reset latch before recomputing it. (verify_loop_structure): Verify that a recorded latch is in fact a latch. * gcc.dg/torture/pr56350.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@196118 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfgloop.c')
-rw-r--r--gcc/cfgloop.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c
index 3619907f727..751da5a2c17 100644
--- a/gcc/cfgloop.c
+++ b/gcc/cfgloop.c
@@ -466,6 +466,8 @@ flow_loops_find (struct loops *loops)
"loop %d with header %d\n",
loop->num, header->index);
}
+ /* Reset latch, we recompute it below. */
+ loop->latch = NULL;
larray.safe_push (loop);
}
@@ -1413,6 +1415,19 @@ verify_loop_structure (void)
error ("loop %d%'s header does not have exactly 2 entries", i);
err = 1;
}
+ if (loop->latch)
+ {
+ if (!find_edge (loop->latch, loop->header))
+ {
+ error ("loop %d%'s latch does not have an edge to its header", i);
+ err = 1;
+ }
+ if (!dominated_by_p (CDI_DOMINATORS, loop->latch, loop->header))
+ {
+ error ("loop %d%'s latch is not dominated by its header", i);
+ err = 1;
+ }
+ }
if (loops_state_satisfies_p (LOOPS_HAVE_SIMPLE_LATCHES))
{
if (!single_succ_p (loop->latch))
OpenPOWER on IntegriCloud