diff options
author | Richard Guenther <rguenther@suse.de> | 2012-09-10 14:10:09 +0000 |
---|---|---|
committer | Richard Guenther <rguenther@suse.de> | 2012-09-10 14:10:09 +0000 |
commit | 63cd082259728865c089361c1c3bb7be0f2d38ff (patch) | |
tree | 82f94d55b64eee4516e88feb661b06a6158dd92c /gcc/tree-ssa-threadupdate.c | |
parent | 5090fa6c3fbaba31acd77e002fe4fccb0dd2bbcb (diff) |
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.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@191141 138bc75d-0d04-0410-961f-82ee72b054a4
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 30336a18e81..ba6d69af942 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. */ |