aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfgloopmanip.c
diff options
context:
space:
mode:
authorZdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>2004-09-23 14:21:31 +0200
committerZdenek Dvorak <rakdver@gcc.gnu.org>2004-09-23 12:21:31 +0000
commit92fc4a2f399b92bf6f9ee3b50373216b01b1ca5e (patch)
tree4eca96bd1993934aaf193e1ddbcaa3b752254965 /gcc/cfgloopmanip.c
parentb8b94c5ba81744d325f235a0409660f50ac3f361 (diff)
downloadgcc-92fc4a2f399b92bf6f9ee3b50373216b01b1ca5e.zip
gcc-92fc4a2f399b92bf6f9ee3b50373216b01b1ca5e.tar.gz
gcc-92fc4a2f399b92bf6f9ee3b50373216b01b1ca5e.tar.bz2
cfgloop.h (update_single_exits_after_duplication): Declare.
* cfgloop.h (update_single_exits_after_duplication): Declare. (loopify, split_loop_bb): Declaration changed. * cfgloopmanip.c (split_loop_bb): Take void * as an argument instead of rtx. (loopify): Added redirect_all_edges argument. (update_single_exits_after_duplication): Export. * loop-unswitch.c (unswitch_loop): Changed due to loopify change. * tree-flow.h (tree_duplicate_loop_to_header_edge, tree_ssa_loop_version): Declare. * tree-ssa-loop-manip.c (copy_phi_node_args, rename_variables, set_phi_def_stmts, tree_duplicate_loop_to_header_edge, lv_adjust_loop_header_phi, lv_adjust_loop_entry_edge, lv_update_pending_stmts, tree_ssa_loop_version): New functions. * tree-ssa-loop-unswitch.c: New file. * Makefile.in (tree-ssa-loop-unswitch.o): Add. * timevar.def (TV_TREE_LOOP_UNSWITCH): New timevar. * tree-flow.h (tree_ssa_unswitch_loops): Declare. * tree-optimize.c (init_tree_optimization_passes): Add pass_unswitch. * tree-pass.h (pass_unswitch): Declare. * tree-ssa-loop.c (tree_ssa_loop_unswitch, gate_tree_ssa_loop_unswitch, pass_unswitch): New pass. * doc/passes.texi: Documen tree level loop unswitching. * gcc.dg/tree-ssa/loop-6.c: New test. From-SVN: r87943
Diffstat (limited to 'gcc/cfgloopmanip.c')
-rw-r--r--gcc/cfgloopmanip.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c
index 6169097..24b2399 100644
--- a/gcc/cfgloopmanip.c
+++ b/gcc/cfgloopmanip.c
@@ -53,7 +53,7 @@ static void fix_irreducible_loops (basic_block);
/* Splits basic block BB after INSN, returns created edge. Updates loops
and dominators. */
edge
-split_loop_bb (basic_block bb, rtx insn)
+split_loop_bb (basic_block bb, void *insn)
{
edge e;
@@ -486,7 +486,7 @@ scale_loop_frequencies (struct loop *loop, int num, int den)
struct loop *
loopify (struct loops *loops, edge latch_edge, edge header_edge,
- basic_block switch_bb)
+ basic_block switch_bb, bool redirect_all_edges)
{
basic_block succ_bb = latch_edge->dest;
basic_block pred_bb = header_edge->src;
@@ -513,12 +513,17 @@ loopify (struct loops *loops, edge latch_edge, edge header_edge,
loop_redirect_edge (latch_edge, loop->header);
loop_redirect_edge (BRANCH_EDGE (switch_bb), succ_bb);
- loop_redirect_edge (header_edge, switch_bb);
- loop_redirect_edge (FALLTHRU_EDGE (switch_bb), loop->header);
-
- /* Update dominators. */
- set_immediate_dominator (CDI_DOMINATORS, switch_bb, pred_bb);
- set_immediate_dominator (CDI_DOMINATORS, loop->header, switch_bb);
+ /* During loop versioning, one of the switch_bb edge is already properly
+ set. Do not redirect it again unless redirect_all_edges is true. */
+ if (redirect_all_edges)
+ {
+ loop_redirect_edge (header_edge, switch_bb);
+ loop_redirect_edge (FALLTHRU_EDGE (switch_bb), loop->header);
+
+ /* Update dominators. */
+ set_immediate_dominator (CDI_DOMINATORS, switch_bb, pred_bb);
+ set_immediate_dominator (CDI_DOMINATORS, loop->header, switch_bb);
+ }
set_immediate_dominator (CDI_DOMINATORS, succ_bb, switch_bb);
@@ -812,7 +817,7 @@ can_duplicate_loop_p (struct loop *loop)
/* The NBBS blocks in BBS will get duplicated and the copies will be placed
to LOOP. Update the single_exit information in superloops of LOOP. */
-static void
+void
update_single_exits_after_duplication (basic_block *bbs, unsigned nbbs,
struct loop *loop)
{
@@ -834,7 +839,6 @@ update_single_exits_after_duplication (basic_block *bbs, unsigned nbbs,
bbs[i]->rbi->duplicated = 0;
}
-
/* Duplicates body of LOOP to given edge E NDUPL times. Takes care of updating
LOOPS structure and dominators. E's destination must be LOOP header for
this to work, i.e. it must be entry or latch edge of this loop; these are