+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
/* 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
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);
}
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);
}
/* 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;
}
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;
}
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;
}
}
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. */
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);
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;
}
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
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. */
/* 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))
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
/* 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;
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;
}
#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
/* 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;