From b375c775b913eba47902f2f0aed89f4e2e22759c Mon Sep 17 00:00:00 2001 From: rguenth Date: Mon, 18 Feb 2013 13:03:15 +0000 Subject: 2013-02-18 Richard Biener 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 --- gcc/cfgloop.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'gcc/cfgloop.c') 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)) -- cgit v1.2.1