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
This commit is contained in:
Kazu Hirata 2004-10-25 21:46:18 +00:00 committed by Kazu Hirata
parent 3401a17fcb
commit 5132abc2a8
5 changed files with 24 additions and 10 deletions

View File

@ -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

View File

@ -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 *);

View File

@ -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);

View File

@ -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);

View File

@ -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)