Commit 1779dc34 by Richard Guenther Committed by Richard Biener

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
parent 8f5a5a8e
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> 2012-09-10 Richard Henderson <rth@redhat.com>
* config/alpha/predicates.md (small_symbolic_operand): Disallow * config/alpha/predicates.md (small_symbolic_operand): Disallow
......
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> 2012-09-10 Jason Merrill <jason@redhat.com>
PR c++/54506 PR c++/54506
......
/* { dg-do compile } */
char *a;
void
fn1 ()
{
char *p = a;
while (p && *p != '\0')
{
while (*p == '\t')
*p++ = '\0';
if (*p != '\0')
p = 0;
}
}
...@@ -846,8 +846,9 @@ static bool ...@@ -846,8 +846,9 @@ static bool
def_split_header_continue_p (const_basic_block bb, const void *data) def_split_header_continue_p (const_basic_block bb, const void *data)
{ {
const_basic_block new_header = (const_basic_block) data; const_basic_block new_header = (const_basic_block) data;
return (bb->loop_father == new_header->loop_father return (bb != new_header
&& 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. /* 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) ...@@ -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, nblocks = dfs_enumerate_from (header, 0, def_split_header_continue_p,
bblocks, loop->num_nodes, tgt_bb); bblocks, loop->num_nodes, tgt_bb);
for (i = 0; i < nblocks; i++) for (i = 0; i < nblocks; i++)
{ if (bblocks[i]->loop_father == loop)
remove_bb_from_loops (bblocks[i]); {
add_bb_to_loop (bblocks[i], loop_outer (loop)); remove_bb_from_loops (bblocks[i]);
} add_bb_to_loop (bblocks[i], loop_outer (loop));
}
free (bblocks); free (bblocks);
/* If the new header has multiple latches mark it so. */ /* If the new header has multiple latches mark it so. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment