tree-ssa-ccp.c (get_default_value): Use SSA_NAME_VALUE rather than SSA_NAME_EQUIV and SET_SSA_NAME_EQUIV.

* tree-ssa-ccp.c (get_default_value): Use SSA_NAME_VALUE rather
	than SSA_NAME_EQUIV and SET_SSA_NAME_EQUIV.
	(substitute_and_fold):  Likewise.
	* tree-ssa-dom.c (tree_ssa_dominator_optimize): Remove everything
	except invariants from SSA_NAME_VALUE.
	(thread_across_edge): Use SSA_NAME_VALUE rather than SSA_NAME_EQUIV
	and SET_SSA_NAME_EQUIV.
	(restore_vars_to_original_value, record_const_or_copy): Likewise.
	(record_equivalences_from_phis, record_const_or_copy_1): Likewise.
	(record_equality, cprop_into_successor_phis): Likewise.
	(record_equivalences_from_stmt, cprop_operand): Likewise.
	(lookup_avail_expr): Likewise.
	* tree-ssa-pre.c (fini_pre): Remove everything except invariants
	from SSA_NAME_VALUE.
	* tree.h (SSA_NAME_EQUIV, SET_SSA_NAME_EQUIV): Kill.
	(struct tree_ssa_name):  Kill EQUIV field.  Remove GGC skip
	annotation from the VALUE_HANDLE field.

From-SVN: r87979
This commit is contained in:
Jeff Law 2004-09-23 14:15:30 -06:00 committed by Jeff Law
parent 0c482362dd
commit 3aecd08b53
5 changed files with 87 additions and 43 deletions

View File

@ -1,3 +1,23 @@
2004-09-23 Jeff Law <law@redhat.com>
* tree-ssa-ccp.c (get_default_value): Use SSA_NAME_VALUE rather
than SSA_NAME_EQUIV and SET_SSA_NAME_EQUIV.
(substitute_and_fold): Likewise.
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Remove everything
except invariants from SSA_NAME_VALUE.
(thread_across_edge): Use SSA_NAME_VALUE rather than SSA_NAME_EQUIV
and SET_SSA_NAME_EQUIV.
(restore_vars_to_original_value, record_const_or_copy): Likewise.
(record_equivalences_from_phis, record_const_or_copy_1): Likewise.
(record_equality, cprop_into_successor_phis): Likewise.
(record_equivalences_from_stmt, cprop_operand): Likewise.
(lookup_avail_expr): Likewise.
* tree-ssa-pre.c (fini_pre): Remove everything except invariants
from SSA_NAME_VALUE.
* tree.h (SSA_NAME_EQUIV, SET_SSA_NAME_EQUIV): Kill.
(struct tree_ssa_name): Kill EQUIV field. Remove GGC skip
annotation from the VALUE_HANDLE field.
2004-09-21 Fariborz Jahanian <fjahanian@apple.com>
PR c++/13989
PR c++/9844

View File

@ -136,11 +136,11 @@ get_default_value (tree var)
val.const_val = NULL_TREE;
if (TREE_CODE (var) == SSA_NAME
&& SSA_NAME_EQUIV (var)
&& is_gimple_min_invariant (SSA_NAME_EQUIV (var)))
&& SSA_NAME_VALUE (var)
&& is_gimple_min_invariant (SSA_NAME_VALUE (var)))
{
val.lattice_val = CONSTANT;
val.const_val = SSA_NAME_EQUIV (var);
val.const_val = SSA_NAME_VALUE (var);
}
else if (TREE_CODE (sym) == PARM_DECL || TREE_THIS_VOLATILE (sym))
{
@ -611,7 +611,7 @@ substitute_and_fold (void)
if (value->lattice_val == CONSTANT
&& is_gimple_reg (name)
&& is_gimple_min_invariant (value->const_val))
SET_SSA_NAME_EQUIV (name, value->const_val)
SSA_NAME_VALUE (name) = value->const_val;
}
}

View File

@ -404,6 +404,24 @@ tree_ssa_dominator_optimize (void)
/* Free nonzero_vars. */
BITMAP_XFREE (nonzero_vars);
BITMAP_XFREE (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;
}
}
static bool
@ -503,8 +521,8 @@ thread_across_edge (struct dom_walk_data *walk_data, edge e)
uses_copy[i] = USE_OP (uses, i);
if (TREE_CODE (USE_OP (uses, i)) == SSA_NAME)
tmp = SSA_NAME_EQUIV (USE_OP (uses, i));
if (tmp)
tmp = SSA_NAME_VALUE (USE_OP (uses, i));
if (tmp && TREE_CODE (tmp) != VALUE_HANDLE)
SET_USE_OP (uses, i, tmp);
}
@ -515,8 +533,8 @@ thread_across_edge (struct dom_walk_data *walk_data, edge e)
vuses_copy[i] = VUSE_OP (vuses, i);
if (TREE_CODE (VUSE_OP (vuses, i)) == SSA_NAME)
tmp = SSA_NAME_EQUIV (VUSE_OP (vuses, i));
if (tmp)
tmp = SSA_NAME_VALUE (VUSE_OP (vuses, i));
if (tmp && TREE_CODE (tmp) != VALUE_HANDLE)
SET_VUSE_OP (vuses, i, tmp);
}
@ -607,15 +625,15 @@ thread_across_edge (struct dom_walk_data *walk_data, edge e)
/* Get the current value of both operands. */
if (TREE_CODE (op0) == SSA_NAME)
{
tree tmp = SSA_NAME_EQUIV (op0);
if (tmp)
tree tmp = SSA_NAME_VALUE (op0);
if (tmp && TREE_CODE (tmp) != VALUE_HANDLE)
op0 = tmp;
}
if (TREE_CODE (op1) == SSA_NAME)
{
tree tmp = SSA_NAME_EQUIV (op1);
if (tmp)
tree tmp = SSA_NAME_VALUE (op1);
if (tmp && TREE_CODE (tmp) != VALUE_HANDLE)
op1 = tmp;
}
@ -654,7 +672,7 @@ thread_across_edge (struct dom_walk_data *walk_data, edge e)
else if (TREE_CODE (cond) == SSA_NAME)
{
cached_lhs = cond;
cached_lhs = SSA_NAME_EQUIV (cached_lhs);
cached_lhs = SSA_NAME_VALUE (cached_lhs);
if (cached_lhs && ! is_gimple_min_invariant (cached_lhs))
cached_lhs = 0;
}
@ -809,7 +827,7 @@ restore_vars_to_original_value (void)
prev_value = VARRAY_TOP_TREE (const_and_copies_stack);
VARRAY_POP (const_and_copies_stack);
SET_SSA_NAME_EQUIV (dest, prev_value);
SSA_NAME_VALUE (dest) = prev_value;
}
}
@ -1067,7 +1085,7 @@ record_equivalences_from_phis (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
by this assignment, so unwinding just costs time and space. */
if (i == PHI_NUM_ARGS (phi)
&& may_propagate_copy (lhs, rhs))
SET_SSA_NAME_EQUIV (lhs, rhs);
SSA_NAME_VALUE (lhs) = rhs;
/* Now see if we know anything about the nonzero property for the
result of this PHI. */
@ -1463,7 +1481,7 @@ record_dominating_conditions (tree cond)
static void
record_const_or_copy_1 (tree x, tree y, tree prev_x)
{
SET_SSA_NAME_EQUIV (x, y);
SSA_NAME_VALUE (x) = y;
VARRAY_PUSH_TREE (const_and_copies_stack, prev_x);
VARRAY_PUSH_TREE (const_and_copies_stack, x);
@ -1475,11 +1493,11 @@ record_const_or_copy_1 (tree x, tree y, tree prev_x)
static void
record_const_or_copy (tree x, tree y)
{
tree prev_x = SSA_NAME_EQUIV (x);
tree prev_x = SSA_NAME_VALUE (x);
if (TREE_CODE (y) == SSA_NAME)
{
tree tmp = SSA_NAME_EQUIV (y);
tree tmp = SSA_NAME_VALUE (y);
if (tmp)
y = tmp;
}
@ -1496,9 +1514,9 @@ record_equality (tree x, tree y)
tree prev_x = NULL, prev_y = NULL;
if (TREE_CODE (x) == SSA_NAME)
prev_x = SSA_NAME_EQUIV (x);
prev_x = SSA_NAME_VALUE (x);
if (TREE_CODE (y) == SSA_NAME)
prev_y = SSA_NAME_EQUIV (y);
prev_y = SSA_NAME_VALUE (y);
/* If one of the previous values is invariant, then use that.
Otherwise it doesn't matter which value we choose, just so
@ -1509,7 +1527,7 @@ record_equality (tree x, tree y)
prev_x = x, x = y, y = prev_x, prev_x = prev_y;
else if (prev_x && TREE_INVARIANT (prev_x))
x = y, y = prev_x, prev_x = prev_y;
else if (prev_y)
else if (prev_y && TREE_CODE (prev_y) != VALUE_HANDLE)
y = prev_y;
/* After the swapping, we must have one SSA_NAME. */
@ -2233,7 +2251,7 @@ cprop_into_successor_phis (basic_block bb, bitmap nonzero_vars)
/* If we have *ORIG_P in our constant/copy table, then replace
ORIG_P with its value in our constant/copy table. */
new = SSA_NAME_EQUIV (orig);
new = SSA_NAME_VALUE (orig);
if (new
&& (TREE_CODE (new) == SSA_NAME
|| is_gimple_min_invariant (new))
@ -2378,7 +2396,7 @@ record_equivalences_from_stmt (tree stmt,
if (may_optimize_p
&& (TREE_CODE (rhs) == SSA_NAME
|| is_gimple_min_invariant (rhs)))
SET_SSA_NAME_EQUIV (lhs, rhs);
SSA_NAME_VALUE (lhs) = rhs;
/* alloca never returns zero and the address of a non-weak symbol
is never zero. NOP_EXPRs and CONVERT_EXPRs can be completely
@ -2500,8 +2518,8 @@ cprop_operand (tree stmt, use_operand_p op_p)
/* If the operand has a known constant value or it is known to be a
copy of some other variable, use the value or copy stored in
CONST_AND_COPIES. */
val = SSA_NAME_EQUIV (op);
if (val)
val = SSA_NAME_VALUE (op);
if (val && TREE_CODE (val) != VALUE_HANDLE)
{
tree op_type, val_type;
@ -2886,8 +2904,8 @@ lookup_avail_expr (tree stmt, bool insert)
use the value from the const_and_copies table. */
if (TREE_CODE (lhs) == SSA_NAME)
{
temp = SSA_NAME_EQUIV (lhs);
if (temp)
temp = SSA_NAME_VALUE (lhs);
if (temp && TREE_CODE (temp) != VALUE_HANDLE)
lhs = temp;
}

View File

@ -1964,6 +1964,8 @@ static void
fini_pre (void)
{
basic_block bb;
unsigned int i;
bsi_commit_edge_inserts (NULL);
obstack_free (&grand_bitmap_obstack, NULL);
@ -1992,6 +1994,20 @@ fini_pre (void)
}
BITMAP_XFREE (need_eh_cleanup);
/* Wipe out pointers to VALUE_HANDLEs. In the not terribly distant
future we will want them to be persistent though. */
for (i = 0; i < num_ssa_names; i++)
{
tree name = ssa_name (i);
if (!name)
continue;
if (SSA_NAME_VALUE (name)
&& TREE_CODE (SSA_NAME_VALUE (name)) == VALUE_HANDLE)
SSA_NAME_VALUE (name) = NULL;
}
}

View File

@ -1312,20 +1312,6 @@ struct tree_exp GTY(())
#define SSA_NAME_IN_FREE_LIST(NODE) \
SSA_NAME_CHECK (NODE)->common.nothrow_flag
/* If NAME is equivalent to some other SSA_NAME or an invariant, then
return the equivalent SSA_NAME or invariant, else return NULL. */
#define SSA_NAME_EQUIV(NAME) __extension__ \
({ tree equiv = SSA_NAME_CHECK (NAME)->ssa_name.equiv; \
if (equiv && TREE_CODE (equiv) == SSA_NAME) \
equiv = ssa_name (SSA_NAME_VERSION (equiv)); \
equiv; \
})
/* Record that NAME (an SSA_NAME) is equivalent to EQUIV. */
#define SET_SSA_NAME_EQUIV(NAME, EQUIV)\
SSA_NAME_CHECK (NAME)->ssa_name.equiv = (EQUIV);
/* Attributes for SSA_NAMEs for pointer-type variables. */
#define SSA_NAME_PTR_INFO(N) \
SSA_NAME_CHECK (N)->ssa_name.ptr_info
@ -1357,8 +1343,12 @@ struct tree_ssa_name GTY(())
/* Pointer attributes used for alias analysis. */
struct ptr_info_def *ptr_info;
/* Value for SSA name used by GVN. */
tree GTY((skip)) value_handle;
/* Value for SSA name used by various passes.
Right now only invariants are allowed to persist beyond a pass in
this field; in the future we will allow VALUE_HANDLEs to persist
as well. */
tree value_handle;
/* Auxiliary information stored with the ssa name. */
PTR GTY((skip)) aux;