get_stmt_operands (stmt);
- FOR_EACH_SSA_TREE_OPERAND (var, stmt, iter, SSA_OP_ALL_USES)
+ FOR_EACH_SSA_TREE_OPERAND (var, stmt, iter, SSA_OP_ALL_USES | SSA_OP_ALL_KILLS)
find_uses_to_rename_use (bb, var, use_blocks);
}
unsigned first_new_block;
basic_block bb;
unsigned i;
- tree phi, arg, map, def;
bitmap definitions;
if (!(loops->state & LOOPS_HAVE_SIMPLE_LATCHES))
return false;
/* Readd the removed phi args for e. */
- map = PENDING_STMT (e);
- PENDING_STMT (e) = NULL;
-
- for (phi = phi_nodes (e->dest), arg = map;
- phi;
- phi = TREE_CHAIN (phi), arg = TREE_CHAIN (arg))
- {
- def = TREE_VALUE (arg);
- add_phi_arg (&phi, def, e);
- }
- gcc_assert (arg == NULL);
+ flush_pending_stmts (e);
/* Copy the phi node arguments. */
copy_phi_node_args (first_new_block);
return new_head;
}
-/* Add phi args using PENDINT_STMT list. */
-
-static void
-lv_update_pending_stmts (edge e)
-{
- basic_block dest;
- tree phi, arg, def;
-
- if (!PENDING_STMT (e))
- return;
-
- dest = e->dest;
-
- for (phi = phi_nodes (dest), arg = PENDING_STMT (e);
- phi;
- phi = TREE_CHAIN (phi), arg = TREE_CHAIN (arg))
- {
- def = TREE_VALUE (arg);
- add_phi_arg (&phi, def, e);
- }
-
- PENDING_STMT (e) = NULL;
-}
-
-
/* Main entry point for Loop Versioning transformation.
This transformation given a condition and a loop, creates
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;
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;
nloop->single_exit = find_edge (exit->src->rbi->copy, exit->dest);
/* loopify redirected latch_edge. Update its PENDING_STMTS. */
- lv_update_pending_stmts (latch_edge);
+ flush_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);
+ flush_pending_stmts (false_edge);
/* Adjust irreducible flag. */
if (irred_flag)