tree_ssa_dominator_optimize (void)
{
struct dom_walk_data walk_data;
- unsigned int i;
memset (&opt_stats, 0, sizeof (opt_stats));
that we update the loop info. */
loop_optimizer_init (LOOPS_HAVE_SIMPLE_LATCHES);
+ /* Initialize the value-handle array. */
+ threadedge_initialize_values ();
+
/* We need accurate information regarding back edges in the CFG
for jump threading; this may include back edges that are not part of
a single loop. */
bitmap_zero (need_eh_cleanup);
}
- /* Finally, remove everything except invariants in SSA_NAME_VALUE.
-
- Long term we will be able to let everything in SSA_NAME_VALUE
- persist. However, for now, we know this is the safe thing to do. */
- for (i = 0; i < num_ssa_names; i++)
- {
- tree name = ssa_name (i);
- tree value;
-
- if (!name)
- continue;
-
- value = SSA_NAME_VALUE (name);
- if (value && !is_gimple_min_invariant (value))
- SSA_NAME_VALUE (name) = NULL;
- }
-
statistics_counter_event (cfun, "Redundant expressions eliminated",
opt_stats.num_re);
statistics_counter_event (cfun, "Constants propagated",
VEC_free (tree, heap, const_and_copies_stack);
VEC_free (gimple_p, heap, stmts_to_rescan);
+ /* Free the value-handle array. */
+ threadedge_finalize_values ();
+ ssa_name_values = NULL;
+
return 0;
}
}
prev_value = VEC_pop (tree, const_and_copies_stack);
- SSA_NAME_VALUE (dest) = prev_value;
+ set_ssa_name_value (dest, prev_value);
}
}
inferred from a comparison. All uses of this ssa name are dominated
by this assignment, so unwinding just costs time and space. */
if (i == gimple_phi_num_args (phi) && may_propagate_copy (lhs, rhs))
- SSA_NAME_VALUE (lhs) = rhs;
+ set_ssa_name_value (lhs, rhs);
}
}
static void
record_const_or_copy_1 (tree x, tree y, tree prev_x)
{
- SSA_NAME_VALUE (x) = y;
+ set_ssa_name_value (x, y);
if (dump_file && (dump_flags & TDF_DETAILS))
{
return retval;
}
-/* Return true if statement GS is an assignment that peforms a useless
- type conversion. It is is intended to be a tuples analog of function
- tree_ssa_useless_type_conversion. */
-
-static bool
-gimple_assign_unary_useless_conversion_p (gimple gs)
-{
- if (is_gimple_assign (gs)
- && (CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (gs))
- || gimple_assign_rhs_code (gs) == VIEW_CONVERT_EXPR
- || gimple_assign_rhs_code (gs) == NON_LVALUE_EXPR))
- {
- tree lhs_type = TREE_TYPE (gimple_assign_lhs (gs));
- tree rhs_type = TREE_TYPE (gimple_assign_rhs1 (gs));
- return useless_type_conversion_p (lhs_type, rhs_type);
- }
-
- return false;
-}
-
/* STMT, a GIMPLE_ASSIGN, may create certain equivalences, in either
the available expressions table or the const_and_copies table.
Detect and record those equivalences. */
lhs_code = TREE_CODE (lhs);
if (lhs_code == SSA_NAME
- && (gimple_assign_single_p (stmt)
- || gimple_assign_unary_useless_conversion_p (stmt)))
+ && gimple_assign_single_p (stmt))
{
tree rhs = gimple_assign_rhs1 (stmt);
- /* Strip away any useless type conversions. */
- STRIP_USELESS_TYPE_CONVERSION (rhs);
-
/* If the RHS of the assignment is a constant or another variable that
may be propagated, register it in the CONST_AND_COPIES table. We
do not need to record unwind data for this, since this is a true
fprintf (dump_file, "\n");
}
- SSA_NAME_VALUE (lhs) = rhs;
+ set_ssa_name_value (lhs, rhs);
}
}