diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-02-18 13:03:15 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-02-18 13:03:15 +0000 |
commit | b375c775b913eba47902f2f0aed89f4e2e22759c (patch) | |
tree | fa9d3fe97ade8428e04dda97cbfe0aa6c5a1329e /gcc/cfgloop.c | |
parent | e6b37e57d7cd38d9ce2553e47e6c702d0d9f492a (diff) | |
download | gcc-b375c775b913eba47902f2f0aed89f4e2e22759c.tar.gz |
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.c | 15 |
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)) |