Commit 42a06e46 by Alexandre Oliva Committed by Alexandre Oliva

tree-ssa.c (find_released_ssa_name): Handle NULL wi.

* tree-ssa.c (find_released_ssa_name): Handle NULL wi.
(insert_debug_temp_for_var_def): Handle degenerate PHI nodes.
(insert_debug_temps_for_defs): Handle PHI nodes.
* tree-ssa-dom.c (degenerate_phi_result): Don't crash on released
SSA names.

From-SVN: r154402
parent b70fdfe4
2009-11-21 Alexandre Oliva <aoliva@redhat.com> 2009-11-21 Alexandre Oliva <aoliva@redhat.com>
* tree-ssa.c (find_released_ssa_name): Handle NULL wi.
(insert_debug_temp_for_var_def): Handle degenerate PHI nodes.
(insert_debug_temps_for_defs): Handle PHI nodes.
* tree-ssa-dom.c (degenerate_phi_result): Don't crash on released
SSA names.
2009-11-21 Alexandre Oliva <aoliva@redhat.com>
* tree-ssa-pre.c (remove_dead_inserted_code): Don't release_defs * tree-ssa-pre.c (remove_dead_inserted_code): Don't release_defs
after remove_phi_node. after remove_phi_node.
...@@ -2398,7 +2398,14 @@ degenerate_phi_result (gimple phi) ...@@ -2398,7 +2398,14 @@ degenerate_phi_result (gimple phi)
continue; continue;
else if (!val) else if (!val)
val = arg; val = arg;
else if (!operand_equal_p (arg, val, 0)) else if (arg == val)
continue;
/* We bring in some of operand_equal_p not only to speed things
up, but also to avoid crashing when dereferencing the type of
a released SSA name. */
else if (!arg || TREE_CODE (val) != TREE_CODE (arg)
|| TREE_CODE (val) == SSA_NAME
|| !operand_equal_p (arg, val, 0))
break; break;
} }
return (i == gimple_phi_num_args (phi) ? val : NULL); return (i == gimple_phi_num_args (phi) ? val : NULL);
......
...@@ -279,7 +279,7 @@ find_released_ssa_name (tree *tp, int *walk_subtrees, void *data_) ...@@ -279,7 +279,7 @@ find_released_ssa_name (tree *tp, int *walk_subtrees, void *data_)
{ {
struct walk_stmt_info *wi = (struct walk_stmt_info *) data_; struct walk_stmt_info *wi = (struct walk_stmt_info *) data_;
if (wi->is_lhs) if (wi && wi->is_lhs)
return NULL_TREE; return NULL_TREE;
if (TREE_CODE (*tp) == SSA_NAME) if (TREE_CODE (*tp) == SSA_NAME)
...@@ -346,7 +346,13 @@ insert_debug_temp_for_var_def (gimple_stmt_iterator *gsi, tree var) ...@@ -346,7 +346,13 @@ insert_debug_temp_for_var_def (gimple_stmt_iterator *gsi, tree var)
/* If we didn't get an insertion point, and the stmt has already /* If we didn't get an insertion point, and the stmt has already
been removed, we won't be able to insert the debug bind stmt, so been removed, we won't be able to insert the debug bind stmt, so
we'll have to drop debug information. */ we'll have to drop debug information. */
if (is_gimple_assign (def_stmt)) if (gimple_code (def_stmt) == GIMPLE_PHI)
{
value = degenerate_phi_result (def_stmt);
if (value && walk_tree (&value, find_released_ssa_name, NULL, NULL))
value = NULL;
}
else if (is_gimple_assign (def_stmt))
{ {
bool no_value = false; bool no_value = false;
...@@ -408,6 +414,7 @@ insert_debug_temp_for_var_def (gimple_stmt_iterator *gsi, tree var) ...@@ -408,6 +414,7 @@ insert_debug_temp_for_var_def (gimple_stmt_iterator *gsi, tree var)
at the expense of duplication of expressions. */ at the expense of duplication of expressions. */
if (CONSTANT_CLASS_P (value) if (CONSTANT_CLASS_P (value)
|| gimple_code (def_stmt) == GIMPLE_PHI
|| (usecount == 1 || (usecount == 1
&& (!gimple_assign_single_p (def_stmt) && (!gimple_assign_single_p (def_stmt)
|| is_gimple_min_invariant (value))) || is_gimple_min_invariant (value)))
...@@ -478,7 +485,7 @@ insert_debug_temps_for_defs (gimple_stmt_iterator *gsi) ...@@ -478,7 +485,7 @@ insert_debug_temps_for_defs (gimple_stmt_iterator *gsi)
stmt = gsi_stmt (*gsi); stmt = gsi_stmt (*gsi);
FOR_EACH_SSA_DEF_OPERAND (def_p, stmt, op_iter, SSA_OP_DEF) FOR_EACH_PHI_OR_STMT_DEF (def_p, stmt, op_iter, SSA_OP_DEF)
{ {
tree var = DEF_FROM_PTR (def_p); tree var = DEF_FROM_PTR (def_p);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment