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
This commit is contained in:
Richard Guenther 2012-09-10 14:10:09 +00:00 committed by Richard Biener
parent 8f5a5a8ecd
commit 1779dc343a
4 changed files with 34 additions and 6 deletions

View File

@ -1,3 +1,9 @@
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.
2012-09-10 Richard Henderson <rth@redhat.com>
* config/alpha/predicates.md (small_symbolic_operand): Disallow

View File

@ -1,3 +1,8 @@
2012-09-10 Richard Guenther <rguenther@suse.de>
PR tree-optimization/54520
* gcc.dg/torture/pr54520.c: New testcase.
2012-09-10 Jason Merrill <jason@redhat.com>
PR c++/54506

View File

@ -0,0 +1,15 @@
/* { dg-do compile } */
char *a;
void
fn1 ()
{
char *p = a;
while (p && *p != '\0')
{
while (*p == '\t')
*p++ = '\0';
if (*p != '\0')
p = 0;
}
}

View File

@ -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. */