diff options
author | Kazu Hirata <kazu@cs.umass.edu> | 2004-10-25 21:46:18 +0000 |
---|---|---|
committer | Kazu Hirata <kazu@gcc.gnu.org> | 2004-10-25 21:46:18 +0000 |
commit | 5132abc2a854979cf96b725ee0aaef2cd3121799 (patch) | |
tree | bae5635c52da0ceca84728ad777ac4425db8d162 /gcc | |
parent | 3401a17fcbee4b9524111a94ddd5208661ad39ce (diff) | |
download | gcc-5132abc2a854979cf96b725ee0aaef2cd3121799.zip gcc-5132abc2a854979cf96b725ee0aaef2cd3121799.tar.gz gcc-5132abc2a854979cf96b725ee0aaef2cd3121799.tar.bz2 |
cfgloopmanip.c (loopify): Take two more arguments true_edge and false_edge.
* cfgloopmanip.c (loopify): Take two more arguments true_edge
and false_edge.
* cfgloop.h: Adjust the corresponding prototype.
* loop-unswitch.c (unswitch_loop): Adjust a call to loopify.
* tree-ssa-loop-manip.c (tree_ssa_loop_version): Likewise.
From-SVN: r89555
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cfgloop.h | 3 | ||||
-rw-r--r-- | gcc/cfgloopmanip.c | 11 | ||||
-rw-r--r-- | gcc/loop-unswitch.c | 3 | ||||
-rw-r--r-- | gcc/tree-ssa-loop-manip.c | 9 |
5 files changed, 24 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e8bdb1f..86c001e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2004-10-25 Kazu Hirata <kazu@cs.umass.edu> + + * cfgloopmanip.c (loopify): Take two more arguments true_edge + and false_edge. + * cfgloop.h: Adjust the corresponding prototype. + * loop-unswitch.c (unswitch_loop): Adjust a call to loopify. + * tree-ssa-loop-manip.c (tree_ssa_loop_version): Likewise. + 2004-10-25 Jakub Jelinek <jakub@redhat.com> * dwarf2out.c (rtl_for_decl_location): Avoid segfault if diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h index 5de3f64..96d865f 100644 --- a/gcc/cfgloop.h +++ b/gcc/cfgloop.h @@ -339,7 +339,8 @@ extern struct loop * duplicate_loop (struct loops *, struct loop *, extern int duplicate_loop_to_header_edge (struct loop *, edge, struct loops *, unsigned, sbitmap, edge, edge *, unsigned *, int); -extern struct loop *loopify (struct loops *, edge, edge, basic_block, bool); +extern struct loop *loopify (struct loops *, edge, edge, + basic_block, edge, edge, bool); extern void unloop (struct loops *, struct loop *); extern bool remove_path (struct loops *, edge); extern edge split_loop_bb (basic_block, void *); diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c index 6d47756..f3e8f18 100644 --- a/gcc/cfgloopmanip.c +++ b/gcc/cfgloopmanip.c @@ -482,13 +482,14 @@ scale_loop_frequencies (struct loop *loop, int num, int den) accordingly. Everything between them plus LATCH_EDGE destination must be dominated by HEADER_EDGE destination, and back-reachable from LATCH_EDGE source. HEADER_EDGE is redirected to basic block SWITCH_BB, - FALLTHRU_EDGE (SWITCH_BB) to original destination of HEADER_EDGE and - BRANCH_EDGE (SWITCH_BB) to original destination of LATCH_EDGE. + FALSE_EDGE of SWITCH_BB to original destination of HEADER_EDGE and + TRUE_EDGE of SWITCH_BB to original destination of LATCH_EDGE. Returns newly created loop. */ struct loop * loopify (struct loops *loops, edge latch_edge, edge header_edge, - basic_block switch_bb, bool redirect_all_edges) + basic_block switch_bb, edge true_edge, edge false_edge, + bool redirect_all_edges) { basic_block succ_bb = latch_edge->dest; basic_block pred_bb = header_edge->src; @@ -514,14 +515,14 @@ loopify (struct loops *loops, edge latch_edge, edge header_edge, /* Redirect edges. */ loop_redirect_edge (latch_edge, loop->header); - loop_redirect_edge (BRANCH_EDGE (switch_bb), succ_bb); + loop_redirect_edge (true_edge, succ_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); + loop_redirect_edge (false_edge, loop->header); /* Update dominators. */ set_immediate_dominator (CDI_DOMINATORS, switch_bb, pred_bb); diff --git a/gcc/loop-unswitch.c b/gcc/loop-unswitch.c index 4960815..d1d49b2 100644 --- a/gcc/loop-unswitch.c +++ b/gcc/loop-unswitch.c @@ -474,7 +474,8 @@ unswitch_loop (struct loops *loops, struct loop *loop, basic_block unswitch_on, /* Loopify from the copy of LOOP body, constructing the new loop. */ nloop = loopify (loops, latch_edge, - EDGE_PRED (loop->header->rbi->copy, 0), switch_bb, true); + EDGE_PRED (loop->header->rbi->copy, 0), switch_bb, + BRANCH_EDGE (switch_bb), FALLTHRU_EDGE (switch_bb), true); /* Remove branches that are now unreachable in new loops. */ remove_path (loops, true_edge); diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c index 2dff13d..dc4b174 100644 --- a/gcc/tree-ssa-loop-manip.c +++ b/gcc/tree-ssa-loop-manip.c @@ -785,7 +785,7 @@ struct loop * tree_ssa_loop_version (struct loops *loops, struct loop * loop, tree cond_expr, basic_block *condition_bb) { - edge entry, latch_edge, exit; + edge entry, latch_edge, exit, true_edge, false_edge; basic_block first_head, second_head; int irred_flag; struct loop *nloop; @@ -819,10 +819,12 @@ tree_ssa_loop_version (struct loops *loops, struct loop * loop, cond_expr); latch_edge = EDGE_SUCC (loop->latch->rbi->copy, 0); + + extract_true_false_edges_from_block (*condition_bb, &true_edge, &false_edge); nloop = loopify (loops, latch_edge, EDGE_PRED (loop->header->rbi->copy, 0), - *condition_bb, + *condition_bb, true_edge, false_edge, false /* Do not redirect all edges. */); exit = loop->single_exit; @@ -833,7 +835,8 @@ tree_ssa_loop_version (struct loops *loops, struct loop * loop, lv_update_pending_stmts (latch_edge); /* loopify redirected condition_bb's succ edge. Update its PENDING_STMTS. */ - lv_update_pending_stmts (FALLTHRU_EDGE (*condition_bb)); + extract_true_false_edges_from_block (*condition_bb, &true_edge, &false_edge); + lv_update_pending_stmts (false_edge); /* Adjust irreducible flag. */ if (irred_flag) |