Commit 72b8d451 by Zdenek Dvorak Committed by Zdenek Dvorak

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
parent 612dc718
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> 2003-03-08 Eric Botcazou <ebotcazou@libertysurf.fr>
PR middle-end/7796 PR middle-end/7796
......
...@@ -4759,6 +4759,7 @@ bypass_block (bb, setcc, jump) ...@@ -4759,6 +4759,7 @@ bypass_block (bb, setcc, jump)
rtx insn, note; rtx insn, note;
edge e, enext; edge e, enext;
int i, change; int i, change;
int may_be_loop_header;
insn = (setcc != NULL) ? setcc : jump; insn = (setcc != NULL) ? setcc : jump;
...@@ -4769,6 +4770,14 @@ bypass_block (bb, setcc, jump) ...@@ -4769,6 +4770,14 @@ bypass_block (bb, setcc, jump)
if (note) if (note)
find_used_regs (&XEXP (note, 0), NULL); 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; change = 0;
for (e = bb->pred; e; e = enext) for (e = bb->pred; e; e = enext)
{ {
...@@ -4780,6 +4789,13 @@ bypass_block (bb, setcc, jump) ...@@ -4780,6 +4789,13 @@ bypass_block (bb, setcc, jump)
if (e->src->index >= bypass_last_basic_block) if (e->src->index >= bypass_last_basic_block)
continue; 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++) for (i = 0; i < reg_use_count; i++)
{ {
struct reg_use *reg_used = &reg_use_table[i]; struct reg_use *reg_used = &reg_use_table[i];
...@@ -4866,6 +4882,7 @@ bypass_conditional_jumps () ...@@ -4866,6 +4882,7 @@ bypass_conditional_jumps ()
return 0; return 0;
bypass_last_basic_block = last_basic_block; bypass_last_basic_block = last_basic_block;
mark_dfs_back_edges ();
changed = 0; changed = 0;
FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR->next_bb->next_bb, FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR->next_bb->next_bb,
......
...@@ -895,7 +895,8 @@ unroll_loop_runtime_iterations (loops, loop) ...@@ -895,7 +895,8 @@ unroll_loop_runtime_iterations (loops, loop)
swtch = loop_split_edge_with (swtch->pred, branch_code, loops); swtch = loop_split_edge_with (swtch->pred, branch_code, loops);
set_immediate_dominator (loops->cfg.dom, preheader, swtch); set_immediate_dominator (loops->cfg.dom, preheader, swtch);
swtch->succ->probability = REG_BR_PROB_BASE - p; 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; e->probability = p;
} }
} }
...@@ -925,7 +926,8 @@ unroll_loop_runtime_iterations (loops, loop) ...@@ -925,7 +926,8 @@ unroll_loop_runtime_iterations (loops, loop)
swtch = loop_split_edge_with (swtch->succ, branch_code, loops); swtch = loop_split_edge_with (swtch->succ, branch_code, loops);
set_immediate_dominator (loops->cfg.dom, preheader, swtch); set_immediate_dominator (loops->cfg.dom, preheader, swtch);
swtch->succ->probability = REG_BR_PROB_BASE - p; 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; e->probability = p;
} }
......
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