gcse.c (bypass_block, [...]): Do not create irreducible loops.

* gcse.c (bypass_block, bypass_conditional_jumps): Do not create
	irreducible loops.

	* loop-unroll.c (unroll_loop_runtime_iterations): Update irreducible
	loops info correctly.

From-SVN: r63980
This commit is contained in:
Zdenek Dvorak 2003-03-08 10:47:28 +01:00 committed by Zdenek Dvorak
parent 612dc71803
commit 72b8d451f1
3 changed files with 29 additions and 2 deletions

View File

@ -1,3 +1,11 @@
2003-03-08 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
* gcse.c (bypass_block, bypass_conditional_jumps): Do not create
irreducible loops.
* loop-unroll.c (unroll_loop_runtime_iterations): Update irreducible
loops info correctly.
2003-03-08 Eric Botcazou <ebotcazou@libertysurf.fr>
PR middle-end/7796

View File

@ -4759,6 +4759,7 @@ bypass_block (bb, setcc, jump)
rtx insn, note;
edge e, enext;
int i, change;
int may_be_loop_header;
insn = (setcc != NULL) ? setcc : jump;
@ -4769,6 +4770,14 @@ bypass_block (bb, setcc, jump)
if (note)
find_used_regs (&XEXP (note, 0), NULL);
may_be_loop_header = false;
for (e = bb->pred; e; e = e->pred_next)
if (e->flags & EDGE_DFS_BACK)
{
may_be_loop_header = true;
break;
}
change = 0;
for (e = bb->pred; e; e = enext)
{
@ -4780,6 +4789,13 @@ bypass_block (bb, setcc, jump)
if (e->src->index >= bypass_last_basic_block)
continue;
/* The irreducible loops created by redirecting of edges entering the
loop from outside would decrease effectivity of some of the following
optimalizations, so prevent this. */
if (may_be_loop_header
&& !(e->flags & EDGE_DFS_BACK))
continue;
for (i = 0; i < reg_use_count; i++)
{
struct reg_use *reg_used = &reg_use_table[i];
@ -4866,6 +4882,7 @@ bypass_conditional_jumps ()
return 0;
bypass_last_basic_block = last_basic_block;
mark_dfs_back_edges ();
changed = 0;
FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR->next_bb->next_bb,

View File

@ -895,7 +895,8 @@ unroll_loop_runtime_iterations (loops, loop)
swtch = loop_split_edge_with (swtch->pred, branch_code, loops);
set_immediate_dominator (loops->cfg.dom, preheader, swtch);
swtch->succ->probability = REG_BR_PROB_BASE - p;
e = make_edge (swtch, preheader, 0);
e = make_edge (swtch, preheader,
swtch->succ->flags & EDGE_IRREDUCIBLE_LOOP);
e->probability = p;
}
}
@ -925,7 +926,8 @@ unroll_loop_runtime_iterations (loops, loop)
swtch = loop_split_edge_with (swtch->succ, branch_code, loops);
set_immediate_dominator (loops->cfg.dom, preheader, swtch);
swtch->succ->probability = REG_BR_PROB_BASE - p;
e = make_edge (swtch, preheader, 0);
e = make_edge (swtch, preheader,
swtch->succ->flags & EDGE_IRREDUCIBLE_LOOP);
e->probability = p;
}