summaryrefslogtreecommitdiff
path: root/gcc/loop-unswitch.c
diff options
context:
space:
mode:
authorrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2003-03-05 22:05:18 +0000
committerrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2003-03-05 22:05:18 +0000
commita5414ff59071320dd80a6541af5befab853ca6ff (patch)
tree8650ebaed410b4e61e93edf3cebafec476c895b8 /gcc/loop-unswitch.c
parenta3e545123024adc8b8b52d235d15dbc37db1f119 (diff)
downloadgcc-a5414ff59071320dd80a6541af5befab853ca6ff.tar.gz
* basic-block.h (EDGE_IRREDUCIBLE_LOOP, EDGE_ALL_FLAGS): New.
* cfg.c (dump_edge_info): Add EDGE_IRREDUCIBLE_LOOP flag dump. * cfgloop.c (flow_loop_free): Made global. (establish_preds): New static function. (flow_loop_tree_node_add): Handle subloops of added loop correctly. (get_loop_exit_edges): New. (verify_loop_structure): Verify EDGE_IRREDUCIBLE_LOOP flags. * cfgloop.h (flow_loop_free, get_loop_exit_edges, unloop): Declare. * cfgloopanal.c (mark_irreducible_loops): Mark edges in irreducible loops. * cfgloopmanip.c (loop_delete_branch_edge): Allow to test for removability of an edge. (fix_irreducible_loops): New static function. (find_path, remove_path): Add ability to remove enclosing loops. (unloop): New. (copy_bbs, duplicate_loop_to_header_edge): Use EDGE_IRREDUCIBLE_LOOP flags. * cfgrtl.c (verify_flow_info): Handle EDGE_IRREDUCIBLE_LOOP flag. * loop-unroll.c (peel_loops_completely): Do not duplicate loop if not neccessary. (decide_peel_completely, peel_loops_completely): Allow complete peeling of non-duplicable once rolling loops. * loop-unswitch.c (unswitch_loop): Update EDGE_IRREDUCIBLE_LOOP flags. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@63864 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/loop-unswitch.c')
-rw-r--r--gcc/loop-unswitch.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/gcc/loop-unswitch.c b/gcc/loop-unswitch.c
index 8d6654c520e..fdce1ebff51 100644
--- a/gcc/loop-unswitch.c
+++ b/gcc/loop-unswitch.c
@@ -335,7 +335,7 @@ unswitch_loop (loops, loop, unswitch_on)
struct loop *loop;
basic_block unswitch_on;
{
- edge entry, e, latch_edge;
+ edge entry, latch_edge;
basic_block switch_bb, unswitch_on_alt, src;
struct loop *nloop;
sbitmap zero_bitmap;
@@ -366,15 +366,15 @@ unswitch_loop (loops, loop, unswitch_on)
/* Make a copy. */
src = entry->src;
- irred_flag = src->flags & BB_IRREDUCIBLE_LOOP;
- src->flags &= ~BB_IRREDUCIBLE_LOOP;
+ irred_flag = entry->flags & EDGE_IRREDUCIBLE_LOOP;
+ entry->flags &= ~EDGE_IRREDUCIBLE_LOOP;
zero_bitmap = sbitmap_alloc (2);
sbitmap_zero (zero_bitmap);
if (!duplicate_loop_to_header_edge (loop, entry, loops, 1,
zero_bitmap, NULL, NULL, NULL, 0))
return NULL;
free (zero_bitmap);
- src->flags |= irred_flag;
+ entry->flags |= irred_flag;
/* Record the block with condition we unswitch on. */
unswitch_on_alt = RBI (unswitch_on)->copy;
@@ -382,8 +382,18 @@ unswitch_loop (loops, loop, unswitch_on)
/* Make a copy of the block containing the condition; we will use
it as switch to decide which loop we want to use. */
switch_bb = cfg_layout_duplicate_bb (unswitch_on, NULL);
- switch_bb->flags &= ~BB_IRREDUCIBLE_LOOP;
- switch_bb->flags |= irred_flag;
+ if (irred_flag)
+ {
+ switch_bb->flags |= BB_IRREDUCIBLE_LOOP;
+ switch_bb->succ->flags |= EDGE_IRREDUCIBLE_LOOP;
+ switch_bb->succ->succ_next->flags |= EDGE_IRREDUCIBLE_LOOP;
+ }
+ else
+ {
+ switch_bb->flags &= ~BB_IRREDUCIBLE_LOOP;
+ switch_bb->succ->flags &= ~EDGE_IRREDUCIBLE_LOOP;
+ switch_bb->succ->succ_next->flags &= ~EDGE_IRREDUCIBLE_LOOP;
+ }
add_to_dominance_info (loops->cfg.dom, switch_bb);
RBI (unswitch_on)->copy = unswitch_on_alt;
@@ -396,10 +406,6 @@ unswitch_loop (loops, loop, unswitch_on)
/* Remove branches that are now unreachable in new loops. We rely on the
fact that cfg_layout_duplicate_bb reverses list of edges. */
- for (e = unswitch_on->succ->succ_next->dest->pred; e; e = e->pred_next)
- if (e->src != unswitch_on &&
- !dominated_by_p (loops->cfg.dom, e->src, e->dest))
- break;
remove_path (loops, unswitch_on->succ);
remove_path (loops, unswitch_on_alt->succ);