diff options
author | Richard Guenther <rguenther@suse.de> | 2012-09-10 14:10:09 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2012-09-10 14:10:09 +0000 |
commit | 1779dc343a559d1d822e8cbcb998bcde049c5123 (patch) | |
tree | 82f94d55b64eee4516e88feb661b06a6158dd92c /gcc/tree-ssa-threadupdate.c | |
parent | 8f5a5a8ecd12377ea58ca7ddb326db59d6cd6436 (diff) | |
download | gcc-1779dc343a559d1d822e8cbcb998bcde049c5123.zip gcc-1779dc343a559d1d822e8cbcb998bcde049c5123.tar.gz gcc-1779dc343a559d1d822e8cbcb998bcde049c5123.tar.bz2 |
re PR middle-end/54520 (ice in merge_latch_edges with -O3)
2012-09-10 Richard Guenther <rguenther@suse.de>
PR tree-optimization/54520
* tree-ssa-threadupdate.c (def_split_header_continue_p):
Properly consider sub-loops.
* gcc.dg/torture/pr54520.c: New testcase.
From-SVN: r191141
Diffstat (limited to 'gcc/tree-ssa-threadupdate.c')
-rw-r--r-- | gcc/tree-ssa-threadupdate.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c index 30336a1..ba6d69a 100644 --- a/gcc/tree-ssa-threadupdate.c +++ b/gcc/tree-ssa-threadupdate.c @@ -846,8 +846,9 @@ static bool def_split_header_continue_p (const_basic_block bb, const void *data) { const_basic_block new_header = (const_basic_block) data; - return (bb->loop_father == new_header->loop_father - && bb != new_header); + return (bb != new_header + && (loop_depth (bb->loop_father) + >= loop_depth (new_header->loop_father))); } /* Thread jumps through the header of LOOP. Returns true if cfg changes. @@ -1031,10 +1032,11 @@ thread_through_loop_header (struct loop *loop, bool may_peel_loop_headers) nblocks = dfs_enumerate_from (header, 0, def_split_header_continue_p, bblocks, loop->num_nodes, tgt_bb); for (i = 0; i < nblocks; i++) - { - remove_bb_from_loops (bblocks[i]); - add_bb_to_loop (bblocks[i], loop_outer (loop)); - } + if (bblocks[i]->loop_father == loop) + { + remove_bb_from_loops (bblocks[i]); + add_bb_to_loop (bblocks[i], loop_outer (loop)); + } free (bblocks); /* If the new header has multiple latches mark it so. */ |