+2008-07-14 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-sccvn.c (pre_info): Remove.
+ (switch_to_PRE_table): Likewise.
+ (free_scc_vn): Do not clear SSA_NAME_VALUE.
+ Do not free pre_info.
+ (set_hashtable_value_ids): Do not create value-ids for the
+ optimistic tables.
+ (run_scc_vn): Remove double test. Remove bogus special-case
+ in value-number printing.
+ * tree-ssa-sccvn.h (switch_to_PRE_table): Remove.
+ * tree-ssa-ccp.c (get_symbol_constant_value): Do not look at
+ SSA_NAME_VALUE.
+ * tree-flow-inline.h (get_value_handle): Remove.
+ * tree-flow.h (get_value_handle): Remove.
+
2008-07-14 Martin Jambor <mjambor@suse.cz>
* tree-switch-conversion.c (gen_inbound_check): Make sure the type
get_var_ann (sym)->symbol_mem_tag = tag;
}
-/* Get the value handle of EXPR. This is the only correct way to get
- the value handle for a "thing". If EXPR does not have a value
- handle associated, it returns NULL_TREE.
- NB: If EXPR is min_invariant, this function is *required* to return
- EXPR. */
-
-static inline tree
-get_value_handle (tree expr)
-{
- if (TREE_CODE (expr) == SSA_NAME)
- return SSA_NAME_VALUE (expr);
- else if (DECL_P (expr) || TREE_CODE (expr) == TREE_LIST
- || TREE_CODE (expr) == CONSTRUCTOR)
- {
- tree_ann_common_t ann = tree_common_ann (expr);
- return ((ann) ? ann->value_handle : NULL_TREE);
- }
- else if (is_gimple_min_invariant (expr))
- return expr;
- else if (EXPR_P (expr))
- {
- tree_ann_common_t ann = tree_common_ann (expr);
- return ((ann) ? ann->value_handle : NULL_TREE);
- }
- else
- gcc_unreachable ();
-}
-
/* Accessor to tree-ssa-operands.c caches. */
static inline struct ssa_operands *
gimple_ssa_operands (const struct function *fun)
change the constant value of the PHI node, which allows for more
constants to be propagated.
- 3- If SSA_NAME_VALUE is set and it is a constant, its value is
- used.
-
- 4- Variables defined by statements other than assignments and PHI
+ 3- Variables defined by statements other than assignments and PHI
nodes are considered VARYING.
- 5- Initial values of variables that are not GIMPLE registers are
+ 4- Initial values of variables that are not GIMPLE registers are
considered VARYING. */
static prop_value_t
non-register when DO_STORE_CCP is false. */
val.lattice_val = VARYING;
}
- else if (SSA_NAME_VALUE (var)
- && is_gimple_min_invariant (SSA_NAME_VALUE (var)))
- {
- val.lattice_val = CONSTANT;
- val.value = SSA_NAME_VALUE (var);
- }
else if ((cst_val = get_symbol_constant_value (sym)) != NULL_TREE)
{
/* Globals and static variables declared 'const' take their
static vn_tables_t optimistic_info;
-/* PRE hashtables storing information about mapping from expressions to
- value handles. */
-
-static vn_tables_t pre_info;
-
/* Pointer to the set of hashtables that is currently being used.
Should always point to either the optimistic_info, or the
valid_info. */
allocate_vn_table (valid_info);
optimistic_info = XCNEW (struct vn_tables_s);
allocate_vn_table (optimistic_info);
- pre_info = NULL;
-}
-
-void
-switch_to_PRE_table (void)
-{
- pre_info = XCNEW (struct vn_tables_s);
- allocate_vn_table (pre_info);
- current_info = pre_info;
}
void
for (i = 0; i < num_ssa_names; i++)
{
tree name = ssa_name (i);
- if (name
- && SSA_NAME_VALUE (name))
- SSA_NAME_VALUE (name) = NULL;
if (name
&& VN_INFO (name)->needs_insertion)
release_ssa_name (name);
XDELETE (valid_info);
free_vn_table (optimistic_info);
XDELETE (optimistic_info);
- if (pre_info)
- {
- free_vn_table (pre_info);
- XDELETE (pre_info);
- }
}
-/* Set the value ids in the valid/optimistic hash tables. */
+/* Set the value ids in the valid hash tables. */
static void
set_hashtable_value_ids (void)
vn_nary_op_t vno;
vn_reference_t vr;
vn_phi_t vp;
-
+
/* Now set the value ids of the things we had put in the hash
table. */
}
}
- FOR_EACH_HTAB_ELEMENT (optimistic_info->nary,
- vno, vn_nary_op_t, hi)
- {
- if (vno->result)
- {
- if (TREE_CODE (vno->result) == SSA_NAME)
- vno->value_id = VN_INFO (vno->result)->value_id;
- else if (is_gimple_min_invariant (vno->result))
- vno->value_id = get_or_alloc_constant_value_id (vno->result);
- }
- }
-
FOR_EACH_HTAB_ELEMENT (valid_info->phis,
vp, vn_phi_t, hi)
{
vp->value_id = get_or_alloc_constant_value_id (vp->result);
}
}
- FOR_EACH_HTAB_ELEMENT (optimistic_info->phis,
- vp, vn_phi_t, hi)
- {
- if (vp->result)
- {
- if (TREE_CODE (vp->result) == SSA_NAME)
- vp->value_id = VN_INFO (vp->result)->value_id;
- else if (is_gimple_min_invariant (vp->result))
- vp->value_id = get_or_alloc_constant_value_id (vp->result);
- }
- }
-
FOR_EACH_HTAB_ELEMENT (valid_info->references,
vr, vn_reference_t, hi)
vr->value_id = get_or_alloc_constant_value_id (vr->result);
}
}
- FOR_EACH_HTAB_ELEMENT (optimistic_info->references,
- vr, vn_reference_t, hi)
- {
- if (vr->result)
- {
- if (TREE_CODE (vr->result) == SSA_NAME)
- vr->value_id = VN_INFO (vr->result)->value_id;
- else if (is_gimple_min_invariant (vr->result))
- vr->value_id = get_or_alloc_constant_value_id (vr->result);
- }
- }
}
/* Do SCCVN. Returns true if it finished, false if we bailed out
info = VN_INFO (name);
if (TREE_CODE (info->valnum) == SSA_NAME
&& info->valnum != name
- && TREE_CODE (info->valnum) == SSA_NAME
&& info->value_id != VN_INFO (info->valnum)->value_id)
{
changed = true;
for (i = 0; i < num_ssa_names; i++)
{
tree name = ssa_name (i);
- if (name && VN_INFO (name)->visited
- && (SSA_VAL (name) != name
- || is_gimple_min_invariant (VN_INFO (name)->expr)))
+ if (name
+ && VN_INFO (name)->visited
+ && SSA_VAL (name) != name)
{
print_generic_expr (dump_file, name, 0);
fprintf (dump_file, " = ");
- if (is_gimple_min_invariant (VN_INFO (name)->expr))
- print_generic_expr (dump_file, VN_INFO (name)->expr, 0);
- else
- print_generic_expr (dump_file, SSA_VAL (name), 0);
+ print_generic_expr (dump_file, SSA_VAL (name), 0);
fprintf (dump_file, "\n");
}
}