/* Add a basic block to the worklist. The block must not be already
in the worklist, and it must not be the ENTRY or EXIT block. */
-static void
+static void
cfg_blocks_add (basic_block bb)
{
bool head = false;
for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
gimple_set_plf (gsi_stmt (si), STMT_IN_SSA_EDGE_WORKLIST, false);
-
+
for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
gimple_set_plf (gsi_stmt (si), STMT_IN_SSA_EDGE_WORKLIST, false);
{
args = VEC_alloc (tree, heap, nargs);
VEC_safe_grow (tree, heap, args, nargs);
-
+
for (i = 0; i < nargs; i++)
VEC_replace (tree, args, i, CALL_EXPR_ARG (expr, i));
}
ssa_prop_init ();
/* Iterate until the worklists are empty. */
- while (!cfg_blocks_empty_p ()
+ while (!cfg_blocks_empty_p ()
|| VEC_length (gimple, interesting_ssa_edges) > 0
|| VEC_length (gimple, varying_ssa_edges) > 0)
{
}
}
}
-
+
if (dump_file && (dump_flags & TDF_DETAILS))
{
if (!replaced)
gimple stmt = gsi_stmt (i);
gimple old_stmt;
enum gimple_code code = gimple_code (stmt);
+ gimple_stmt_iterator oldi;
+
+ oldi = i;
+ gsi_prev (&i);
/* Ignore ASSERT_EXPRs. They are used by VRP to generate
range information for names and they are discarded
if (code == GIMPLE_ASSIGN
&& TREE_CODE (gimple_assign_rhs1 (stmt)) == ASSERT_EXPR)
- {
- gsi_prev (&i);
- continue;
- }
+ continue;
/* No point propagating into a stmt whose result is not used,
but instead we might be able to remove a trivially dead stmt. */
fprintf (dump_file, "\n");
}
prop_stats.num_dce++;
- gsi_prev (&i);
i2 = gsi_for_stmt (stmt);
gsi_remove (&i2, true);
release_defs (stmt);
specific information. Do this before propagating
into the stmt to not disturb pass specific information. */
if (fold_fn
- && (*fold_fn)(&i))
+ && (*fold_fn)(&oldi))
{
did_replace = true;
prop_stats.num_stmts_folded++;
/* If we made a replacement, fold the statement. */
if (did_replace)
- fold_stmt (&i);
+ fold_stmt (&oldi);
/* Now cleanup. */
if (did_replace)
{
- stmt = gsi_stmt (i);
+ stmt = gsi_stmt (oldi);
/* If we cleaned up EH information from the statement,
remove EH edges. */
== GIMPLE_SINGLE_RHS))
{
tree rhs = gimple_assign_rhs1 (stmt);
-
+
if (TREE_CODE (rhs) == ADDR_EXPR)
recompute_tree_invariant_for_addr_expr (rhs);
}
else
fprintf (dump_file, "Not folded\n");
}
-
- gsi_prev (&i);
}
}