summaryrefslogtreecommitdiff
path: root/gcc/gcse.c
diff options
context:
space:
mode:
authorZdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>2003-03-08 10:47:28 +0100
committerZdenek Dvorak <rakdver@gcc.gnu.org>2003-03-08 09:47:28 +0000
commit72b8d451f1b0c3bef4b3afc688ada5d5175d97d0 (patch)
tree2049f3fc3ca464bc5ba32b5c28fce7018ba25366 /gcc/gcse.c
parent612dc71803c6a8419ad07b13462dd15732d650b4 (diff)
downloadgcc-72b8d451f1b0c3bef4b3afc688ada5d5175d97d0.tar.gz
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
Diffstat (limited to 'gcc/gcse.c')
-rw-r--r--gcc/gcse.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/gcse.c b/gcc/gcse.c
index f5bb66d0053..f0e588ecd49 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -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,