Commit 811ee85b by Richard Biener Committed by Richard Biener

re PR middle-end/52996 (ice in verify_loop_structure, at cfgloop.c:1567)

2012-12-21  Richard Biener  <rguenther@suse.de>

	PR rtl-optimization/52996
	* cprop.c (bypass_block): When loops are to be preserved
	do not bypass loop headers.  Revert earlier kludge to remove
	loops when doing that.

From-SVN: r194666
parent d106911b
2012-12-21 Richard Biener <rguenther@suse.de> 2012-12-21 Richard Biener <rguenther@suse.de>
PR rtl-optimization/52996
* cprop.c (bypass_block): When loops are to be preserved
do not bypass loop headers. Revert earlier kludge to remove
loops when doing that.
2012-12-21 Richard Biener <rguenther@suse.de>
PR bootstrap/54659 PR bootstrap/54659
* system.h: Include gmp.h. * system.h: Include gmp.h.
* tree-ssa-loop-niter.c: Do not include gmp.h here. * tree-ssa-loop-niter.c: Do not include gmp.h here.
...@@ -1496,7 +1496,7 @@ bypass_block (basic_block bb, rtx setcc, rtx jump) ...@@ -1496,7 +1496,7 @@ bypass_block (basic_block bb, rtx setcc, rtx jump)
rtx insn, note; rtx insn, note;
edge e, edest; edge e, edest;
int change; int change;
int may_be_loop_header; int may_be_loop_header = false;
unsigned removed_p; unsigned removed_p;
unsigned i; unsigned i;
edge_iterator ei; edge_iterator ei;
...@@ -1510,27 +1510,22 @@ bypass_block (basic_block bb, rtx setcc, rtx jump) ...@@ -1510,27 +1510,22 @@ bypass_block (basic_block bb, rtx setcc, rtx jump)
if (note) if (note)
find_used_regs (&XEXP (note, 0), NULL); find_used_regs (&XEXP (note, 0), NULL);
/* Determine whether there are more latch edges. Threading through
a loop header with more than one latch is delicate, see e.g.
tree-ssa-threadupdate.c:thread_through_loop_header. */
if (current_loops) if (current_loops)
{ {
may_be_loop_header = bb == bb->loop_father->header; /* If we are to preserve loop structure then do not bypass
if (may_be_loop_header a loop header. This will either rotate the loop, create
&& bb->loop_father->latch == NULL) multiple entry loops or even irreducible regions. */
if (bb == bb->loop_father->header)
return 0; return 0;
} }
else else
{ {
unsigned n_back_edges = 0;
FOR_EACH_EDGE (e, ei, bb->preds) FOR_EACH_EDGE (e, ei, bb->preds)
if (e->flags & EDGE_DFS_BACK) if (e->flags & EDGE_DFS_BACK)
n_back_edges++; {
may_be_loop_header = true;
may_be_loop_header = n_back_edges > 0; break;
}
if (n_back_edges > 1)
return 0;
} }
change = 0; change = 0;
...@@ -1619,17 +1614,6 @@ bypass_block (basic_block bb, rtx setcc, rtx jump) ...@@ -1619,17 +1614,6 @@ bypass_block (basic_block bb, rtx setcc, rtx jump)
&& dest != old_dest && dest != old_dest
&& dest != EXIT_BLOCK_PTR) && dest != EXIT_BLOCK_PTR)
{ {
if (current_loops != NULL
&& e->src->loop_father->latch == e->src)
{
/* ??? Now we are creating (or may create) a loop
with multiple entries. Simply mark it for
removal. Alternatively we could not do this
threading. */
e->src->loop_father->header = NULL;
e->src->loop_father->latch = NULL;
}
redirect_edge_and_branch_force (e, dest); redirect_edge_and_branch_force (e, dest);
/* Copy the register setter to the redirected edge. /* Copy the register setter to the redirected edge.
......
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