Commit 9b3b55a1 by Diego Novillo Committed by Diego Novillo

* tree-scalar-evolution.c (scev_const_prop):

	* tree-phinodes.c (remove_phi_node): Add argument
	RELEASE_LHS_P.  If given, release the SSA name on the LHS of
	the PHI node.
	Update all users.
	* tree-ssa-dce.c: Remove forward declarations for static
	functions.  Re-arrange functions bodies as needed.
	(find_obviously_necessary_stmts): Never mark PHI nodes as
	obviously necessary.

From-SVN: r119740
parent 546447ae
2006-12-11 Diego Novillo <dnovillo@redhat.com>
* tree-scalar-evolution.c (scev_const_prop):
* tree-phinodes.c (remove_phi_node): Add argument
RELEASE_LHS_P. If given, release the SSA name on the LHS of
the PHI node.
Update all users.
* tree-ssa-dce.c: Remove forward declarations for static
functions. Re-arrange functions bodies as needed.
(find_obviously_necessary_stmts): Never mark PHI nodes as
obviously necessary.
2006-12-11 Carlos O'Donell <carlos@codesourcery.com>
* config/arm/elf.h (MAX_OFILE_ALIGNMENT): Remove definition.
......
......@@ -2474,13 +2474,9 @@ perfect_nestify (struct loop *loop,
}
e = redirect_edge_and_branch (single_succ_edge (preheaderbb), headerbb);
/* Remove the exit phis from the old basic block. Make sure to set
PHI_RESULT to null so it doesn't get released. */
/* Remove the exit phis from the old basic block. */
while (phi_nodes (olddest) != NULL)
{
SET_PHI_RESULT (phi_nodes (olddest), NULL);
remove_phi_node (phi_nodes (olddest), NULL);
}
remove_phi_node (phi_nodes (olddest), NULL, false);
/* and add them back to the new basic block. */
while (VEC_length (tree, phis) != 0)
......
......@@ -1333,13 +1333,12 @@ tree_merge_blocks (basic_block a, basic_block b)
appear as arguments of the phi nodes. */
copy = build2_gimple (GIMPLE_MODIFY_STMT, def, use);
bsi_insert_after (&bsi, copy, BSI_NEW_STMT);
SET_PHI_RESULT (phi, NULL_TREE);
SSA_NAME_DEF_STMT (def) = copy;
}
else
replace_uses_by (def, use);
remove_phi_node (phi, NULL);
remove_phi_node (phi, NULL, false);
}
/* Ensure that B follows A. */
......@@ -1970,7 +1969,7 @@ remove_phi_nodes_and_edges_for_unreachable_block (basic_block bb)
while (phi)
{
tree next = PHI_CHAIN (phi);
remove_phi_node (phi, NULL_TREE);
remove_phi_node (phi, NULL_TREE, true);
phi = next;
}
......
......@@ -687,7 +687,7 @@ extern void reserve_phi_args_for_new_edge (basic_block);
extern tree create_phi_node (tree, basic_block);
extern void add_phi_arg (tree, tree, edge);
extern void remove_phi_args (edge);
extern void remove_phi_node (tree, tree);
extern void remove_phi_node (tree, tree, bool);
extern tree phi_reverse (tree);
/* In gimple-low.c */
......
......@@ -639,7 +639,7 @@ eliminate_virtual_phis (void)
}
}
#endif
remove_phi_node (phi, NULL_TREE);
remove_phi_node (phi, NULL_TREE, true);
}
}
}
......@@ -1170,13 +1170,13 @@ remove_ssa_form (bool perform_ter)
if (values)
free (values);
/* Remove phi nodes which have been translated back to real variables. */
/* Remove PHI nodes which have been translated back to real variables. */
FOR_EACH_BB (bb)
{
for (phi = phi_nodes (bb); phi; phi = next)
{
next = PHI_CHAIN (phi);
remove_phi_node (phi, NULL_TREE);
remove_phi_node (phi, NULL_TREE, true);
}
}
......
......@@ -233,6 +233,7 @@ make_phi_node (tree var, int len)
imm->next = NULL;
imm->stmt = phi;
}
return phi;
}
......@@ -301,7 +302,6 @@ resize_phi_node (tree *phi, int len)
imm->stmt = new_phi;
}
*phi = new_phi;
}
......@@ -343,6 +343,7 @@ reserve_phi_args_for_new_edge (basic_block bb)
}
}
/* Create a new PHI node for variable VAR at basic block BB. */
tree
......@@ -362,6 +363,7 @@ create_phi_node (tree var, basic_block bb)
return phi;
}
/* Add a new argument to PHI node PHI. DEF is the incoming reaching
definition and E is the edge through which DEF reaches PHI. The new
argument is added at the end of the argument list.
......@@ -394,6 +396,7 @@ add_phi_arg (tree phi, tree def, edge e)
SET_PHI_ARG_DEF (phi, e->dest_idx, def);
}
/* Remove the Ith argument from PHI's argument list. This routine
implements removal by swapping the last alternative with the
alternative we want to delete and then shrinking the vector, which
......@@ -406,7 +409,6 @@ remove_phi_arg_num (tree phi, int i)
gcc_assert (i < num_elem);
/* Delink the item which is being removed. */
delink_imm_use (&(PHI_ARG_IMM_USE_NODE (phi, i)));
......@@ -428,6 +430,7 @@ remove_phi_arg_num (tree phi, int i)
PHI_NUM_ARGS (phi)--;
}
/* Remove all PHI arguments associated with edge E. */
void
......@@ -439,11 +442,14 @@ remove_phi_args (edge e)
remove_phi_arg_num (phi, e->dest_idx);
}
/* Remove PHI node PHI from basic block BB. If PREV is non-NULL, it is
used as the node immediately before PHI in the linked list. */
used as the node immediately before PHI in the linked list. If
RELEASE_LHS_P is true, the LHS of this PHI node is released into
the free pool of SSA names. */
void
remove_phi_node (tree phi, tree prev)
remove_phi_node (tree phi, tree prev, bool release_lhs_p)
{
tree *loc;
......@@ -465,7 +471,8 @@ remove_phi_node (tree phi, tree prev)
/* If we are deleting the PHI node, then we should release the
SSA_NAME node so that it can be reused. */
release_phi_node (phi);
release_ssa_name (PHI_RESULT (phi));
if (release_lhs_p)
release_ssa_name (PHI_RESULT (phi));
}
......
......@@ -2929,8 +2929,9 @@ scev_const_prop (void)
}
}
/* Remove the ssa names that were replaced by constants. We do not remove them
directly in the previous cycle, since this invalidates scev cache. */
/* Remove the ssa names that were replaced by constants. We do not
remove them directly in the previous cycle, since this
invalidates scev cache. */
if (ssa_names_to_remove)
{
bitmap_iterator bi;
......@@ -2941,7 +2942,7 @@ scev_const_prop (void)
phi = SSA_NAME_DEF_STMT (name);
gcc_assert (TREE_CODE (phi) == PHI_NODE);
remove_phi_node (phi, NULL);
remove_phi_node (phi, NULL, true);
}
BITMAP_FREE (ssa_names_to_remove);
......@@ -2998,11 +2999,10 @@ scev_const_prop (void)
|| contains_abnormal_ssa_name_p (def))
continue;
/* Eliminate the phi node and replace it by a computation outside
/* Eliminate the PHI node and replace it by a computation outside
the loop. */
def = unshare_expr (def);
SET_PHI_RESULT (phi, NULL_TREE);
remove_phi_node (phi, NULL_TREE);
remove_phi_node (phi, NULL_TREE, false);
ass = build2 (GIMPLE_MODIFY_STMT, void_type_node, rslt, NULL_TREE);
SSA_NAME_DEF_STMT (rslt) = ass;
......
......@@ -2089,7 +2089,7 @@ static void
remove_stmt_or_phi (tree t)
{
if (TREE_CODE (t) == PHI_NODE)
remove_phi_node (t, NULL);
remove_phi_node (t, NULL, true);
else
{
block_stmt_iterator bsi = bsi_for_stmt (t);
......
......@@ -5351,12 +5351,7 @@ remove_statement (tree stmt, bool including_defined_name)
{
if (TREE_CODE (stmt) == PHI_NODE)
{
if (!including_defined_name)
{
/* Prevent the ssa name defined by the statement from being removed. */
SET_PHI_RESULT (stmt, NULL);
}
remove_phi_node (stmt, NULL_TREE);
remove_phi_node (stmt, NULL_TREE, including_defined_name);
}
else
{
......
......@@ -4035,7 +4035,7 @@ remove_dead_inserted_code (void)
if (TREE_CODE (t) == PHI_NODE)
{
remove_phi_node (t, NULL);
remove_phi_node (t, NULL, true);
}
else
{
......
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