FOR_EACH_IMM_USE_SAFE (use, imm_iter, name)
{
stmt = USE_STMT (use);
-
- SET_USE (use, val);
+ replace_exp (use, val);
if (TREE_CODE (stmt) == PHI_NODE)
{
if (TREE_CODE (rhs) == ADDR_EXPR)
recompute_tree_invarant_for_addr_expr (rhs);
+ /* If the statement could throw and now cannot, we need to prune cfg. */
+ if (maybe_clean_or_replace_eh_stmt (stmt, stmt))
+ tree_purge_dead_eh_edges (bb_for_stmt (stmt));
+
mark_new_vars_to_rename (stmt);
}
{
tree def = PHI_RESULT (phi), use = PHI_ARG_DEF (phi, 0);
tree copy;
-
- if (!may_propagate_copy (def, use))
+ bool may_replace_uses = may_propagate_copy (def, use);
+
+ /* In case we have loops to care about, do not propagate arguments of
+ loop closed ssa phi nodes. */
+ if (current_loops
+ && is_gimple_reg (def)
+ && TREE_CODE (use) == SSA_NAME
+ && a->loop_father != b->loop_father)
+ may_replace_uses = false;
+
+ if (!may_replace_uses)
{
gcc_assert (is_gimple_reg (def));
{
loop->latch = NULL;
loop->header = NULL;
+
+ /* Also clean up the information associated with the loop. Updating
+ it would waste time. More importantly, it may refer to ssa
+ names that were defined in other removed basic block -- these
+ ssa names are now removed and invalid. */
+ free_numbers_of_iterations_estimates_loop (loop);
}
}
if (TREE_CODE (tmp) == RETURN_EXPR)
{
tree op = TREE_OPERAND (tmp, 0);
- if (!is_gimple_val (op))
+ if (op && !is_gimple_val (op))
{
gcc_assert (TREE_CODE (op) == MODIFY_EXPR);
bsi_insert_before (bsi, op, BSI_NEW_STMT);
{
tree last = last_stmt (e->src);
if (TREE_CODE (last) == RETURN_EXPR
- && TREE_OPERAND (last, 0) == NULL)
+ && TREE_OPERAND (last, 0) == NULL
+ && !TREE_NO_WARNING (last))
{
#ifdef USE_MAPPED_LOCATION
location = EXPR_LOCATION (last);