+2012-08-08 Richard Guenther <rguenther@suse.de>
+
+ * tree-call-cdce.c (check_pow): Simplify.
+ (gen_conditions_for_pow_int_base): Likewise.
+ * tree-ssa-dom.c (propagate_rhs_into_lhs): Do not handle
+ virtual operands here.
+ * tree-ssa-operands.c (get_name_decl): Remove unused function.
+ * gimplify.c (gimple_regimplify_operands): Remove dead code.
+ * tree-vrp.c (get_value_range): Move SSA_NAME_VAR access.
+ * tree-parloops.c (create_phi_for_local_result): Use copy_ssa_name.
+ * value-prof.c (gimple_ic): Use duplicate_ssa_name.
+ (gimple_stringop_fixed_value): Likewise.
+ * tree.c (needs_to_live_in_memory): Remove SSA name handling.
+ * tree-stdarg.c (find_va_list_reference): Store SSA_NAME_VERSIONs
+ in the bitmap alongside shifted DECL_UIDs.
+ (va_list_counter_struct_op): Likewise.
+ (va_list_ptr_read): Likewise.
+ (va_list_ptr_write): Likewise.
+ (check_va_list_escapes): Likewise.
+ (check_all_va_list_escapes): Likewise.
+ (execute_optimize_stdarg): Likewise.
+ * tree-outof-ssa.c (insert_backedge_copies): Use copy_ssa_name.
+
2012-08-08 Richard Sandiford <rdsandiford@googlemail.com>
H.J. Lu <hongjiu.lu@intel.com>
gimple_regimplify_operands (gimple stmt, gimple_stmt_iterator *gsi_p)
{
size_t i, num_ops;
- tree orig_lhs = NULL_TREE, lhs;
+ tree lhs;
gimple_seq pre = NULL;
gimple post_stmt = NULL;
struct gimplify_ctx gctx;
and ASMs are executed before the LHS. The ordering is not
important for other statements. */
num_ops = gimple_num_ops (stmt);
- orig_lhs = gimple_get_lhs (stmt);
for (i = num_ops; i > 0; i--)
{
tree op = gimple_op (stmt, i - 1);
if (need_temp)
{
tree temp = create_tmp_reg (TREE_TYPE (lhs), NULL);
-
- if (TREE_CODE (orig_lhs) == SSA_NAME)
- orig_lhs = SSA_NAME_VAR (orig_lhs);
-
if (gimple_in_ssa_p (cfun))
temp = make_ssa_name (temp, NULL);
gimple_set_lhs (stmt, temp);
}
else if (bc == SSA_NAME)
{
- tree base_val0, base_var, type;
+ tree base_val0, type;
gimple base_def;
int bit_sz;
return false;
base_val0 = gimple_assign_rhs1 (base_def);
- base_var = SSA_NAME_VAR (base_val0);
- if (!DECL_P (base_var))
- return false;
-
- type = TREE_TYPE (base_var);
+ type = TREE_TYPE (base_val0);
if (TREE_CODE (type) != INTEGER_TYPE)
return false;
bit_sz = TYPE_PRECISION (type);
{
gimple base_def;
tree base_val0;
- tree base_var, int_type;
+ tree int_type;
tree temp, tempn;
tree cst0;
gimple stmt1, stmt2;
base_def = SSA_NAME_DEF_STMT (base);
base_val0 = gimple_assign_rhs1 (base_def);
- base_var = SSA_NAME_VAR (base_val0);
- int_type = TREE_TYPE (base_var);
+ int_type = TREE_TYPE (base_val0);
bit_sz = TYPE_PRECISION (int_type);
gcc_assert (bit_sz > 0
&& bit_sz <= MAX_BASE_INT_BIT_SIZE);
{
gimple phi = gsi_stmt (gsi);
tree result = gimple_phi_result (phi);
- tree result_var;
size_t i;
if (!is_gimple_reg (result))
continue;
- result_var = SSA_NAME_VAR (result);
for (i = 0; i < gimple_phi_num_args (phi); i++)
{
tree arg = gimple_phi_arg_def (phi, i);
needed. */
if ((e->flags & EDGE_DFS_BACK)
&& (TREE_CODE (arg) != SSA_NAME
- || SSA_NAME_VAR (arg) != result_var
+ || SSA_NAME_VAR (arg) != SSA_NAME_VAR (result)
|| trivially_conflicts_p (bb, result, arg)))
{
tree name;
/* Create a new instance of the underlying variable of the
PHI result. */
- stmt = gimple_build_assign (result_var,
+ name = copy_ssa_name (result, NULL);
+ stmt = gimple_build_assign (name,
gimple_phi_arg_def (phi, i));
- name = make_ssa_name (result_var, stmt);
- gimple_assign_set_lhs (stmt, name);
/* copy location if present. */
if (gimple_phi_arg_has_location (phi, i))
e = EDGE_PRED (store_bb, 1);
else
e = EDGE_PRED (store_bb, 0);
- local_res
- = make_ssa_name (SSA_NAME_VAR (gimple_assign_lhs (reduc->reduc_stmt)),
- NULL);
+ local_res = copy_ssa_name (gimple_assign_lhs (reduc->reduc_stmt), NULL);
locus = gimple_location (reduc->reduc_stmt);
new_phi = create_phi_node (local_res, store_bb);
add_phi_arg (new_phi, reduc->init, e, locus);
/* Special cases to avoid useless calls into the folding
routines, operand scanning, etc.
- First, propagation into a PHI may cause the PHI to become
+ Propagation into a PHI may cause the PHI to become
a degenerate, so mark the PHI as interesting. No other
- actions are necessary.
-
- Second, if we're propagating a virtual operand and the
- propagation does not change the underlying _DECL node for
- the virtual operand, then no further actions are necessary. */
- if (gimple_code (use_stmt) == GIMPLE_PHI
- || (! is_gimple_reg (lhs)
- && TREE_CODE (rhs) == SSA_NAME
- && SSA_NAME_VAR (lhs) == SSA_NAME_VAR (rhs)))
+ actions are necessary. */
+ if (gimple_code (use_stmt) == GIMPLE_PHI)
{
+ tree result;
+
/* Dump details. */
if (dump_file && (dump_flags & TDF_DETAILS))
{
print_gimple_stmt (dump_file, use_stmt, 0, dump_flags);
}
- /* Propagation into a PHI may expose new degenerate PHIs,
- so mark the result of the PHI as interesting. */
- if (gimple_code (use_stmt) == GIMPLE_PHI)
- {
- tree result = get_lhs_or_phi_result (use_stmt);
- bitmap_set_bit (interesting_names, SSA_NAME_VERSION (result));
- }
-
+ result = get_lhs_or_phi_result (use_stmt);
+ bitmap_set_bit (interesting_names, SSA_NAME_VERSION (result));
continue;
}
/* Number of functions with initialized ssa_operands. */
static int n_initialized = 0;
-/* Return the DECL_UID of the base variable of T. */
-
-static inline unsigned
-get_name_decl (const_tree t)
-{
- if (TREE_CODE (t) != SSA_NAME)
- return DECL_UID (t);
- else
- return DECL_UID (SSA_NAME_VAR (t));
-}
-
/* Return true if the SSA operands cache is active. */
tree var = *tp;
if (TREE_CODE (var) == SSA_NAME)
- var = SSA_NAME_VAR (var);
-
- if (TREE_CODE (var) == VAR_DECL
- && bitmap_bit_p (va_list_vars, DECL_UID (var)))
- return var;
+ {
+ if (bitmap_bit_p (va_list_vars, SSA_NAME_VERSION (var)))
+ return var;
+ }
+ else if (TREE_CODE (var) == VAR_DECL)
+ {
+ if (bitmap_bit_p (va_list_vars, DECL_UID (var) + num_ssa_names))
+ return var;
+ }
return NULL_TREE;
}
return false;
if (TREE_CODE (var) != SSA_NAME
- || bitmap_bit_p (si->va_list_vars, DECL_UID (SSA_NAME_VAR (var))))
+ || bitmap_bit_p (si->va_list_vars, SSA_NAME_VERSION (var)))
return false;
base = get_base_address (ap);
if (TREE_CODE (base) != VAR_DECL
- || !bitmap_bit_p (si->va_list_vars, DECL_UID (base)))
+ || !bitmap_bit_p (si->va_list_vars, DECL_UID (base) + num_ssa_names))
return false;
if (TREE_OPERAND (ap, 1) == va_list_gpr_counter_field)
va_list_ptr_read (struct stdarg_info *si, tree ap, tree tem)
{
if (TREE_CODE (ap) != VAR_DECL
- || !bitmap_bit_p (si->va_list_vars, DECL_UID (ap)))
+ || !bitmap_bit_p (si->va_list_vars, DECL_UID (ap) + num_ssa_names))
return false;
if (TREE_CODE (tem) != SSA_NAME
- || bitmap_bit_p (si->va_list_vars,
- DECL_UID (SSA_NAME_VAR (tem)))
- || is_global_var (SSA_NAME_VAR (tem)))
+ || bitmap_bit_p (si->va_list_vars, SSA_NAME_VERSION (tem)))
return false;
if (si->compute_sizes < 0)
/* Note the temporary, as we need to track whether it doesn't escape
the current function. */
- bitmap_set_bit (si->va_list_escape_vars,
- DECL_UID (SSA_NAME_VAR (tem)));
+ bitmap_set_bit (si->va_list_escape_vars, SSA_NAME_VERSION (tem));
+
return true;
}
unsigned HOST_WIDE_INT increment;
if (TREE_CODE (ap) != VAR_DECL
- || !bitmap_bit_p (si->va_list_vars, DECL_UID (ap)))
+ || !bitmap_bit_p (si->va_list_vars, DECL_UID (ap) + num_ssa_names))
return false;
if (TREE_CODE (tem2) != SSA_NAME
- || bitmap_bit_p (si->va_list_vars, DECL_UID (SSA_NAME_VAR (tem2))))
+ || bitmap_bit_p (si->va_list_vars, SSA_NAME_VERSION (tem2)))
return false;
if (si->compute_sizes <= 0)
if (TREE_CODE (rhs) == SSA_NAME)
{
- if (! bitmap_bit_p (si->va_list_escape_vars,
- DECL_UID (SSA_NAME_VAR (rhs))))
+ if (! bitmap_bit_p (si->va_list_escape_vars, SSA_NAME_VERSION (rhs)))
return;
}
else if (TREE_CODE (rhs) == ADDR_EXPR
&& TREE_CODE (TREE_OPERAND (rhs, 0)) == MEM_REF
&& TREE_CODE (TREE_OPERAND (TREE_OPERAND (rhs, 0), 0)) == SSA_NAME)
{
- if (! bitmap_bit_p (si->va_list_escape_vars,
- DECL_UID (SSA_NAME_VAR (TREE_OPERAND
- (TREE_OPERAND (rhs, 0), 0)))))
+ tree ptr = TREE_OPERAND (TREE_OPERAND (rhs, 0), 0);
+ if (! bitmap_bit_p (si->va_list_escape_vars, SSA_NAME_VERSION (ptr)))
return;
}
else
return;
- if (TREE_CODE (lhs) != SSA_NAME || is_global_var (SSA_NAME_VAR (lhs)))
+ if (TREE_CODE (lhs) != SSA_NAME)
{
si->va_list_escapes = true;
return;
return;
}
- bitmap_set_bit (si->va_list_escape_vars,
- DECL_UID (SSA_NAME_VAR (lhs)));
+ bitmap_set_bit (si->va_list_escape_vars, SSA_NAME_VERSION (lhs));
}
FOR_EACH_SSA_TREE_OPERAND (use, stmt, iter, SSA_OP_ALL_USES)
{
if (! bitmap_bit_p (si->va_list_escape_vars,
- DECL_UID (SSA_NAME_VAR (use))))
+ SSA_NAME_VERSION (use)))
continue;
if (is_gimple_assign (stmt))
if (TREE_CODE (lhs) == SSA_NAME
&& bitmap_bit_p (si->va_list_escape_vars,
- DECL_UID (SSA_NAME_VAR (lhs))))
+ SSA_NAME_VERSION (lhs)))
continue;
if (TREE_CODE (lhs) == VAR_DECL
&& bitmap_bit_p (si->va_list_vars,
- DECL_UID (lhs)))
+ DECL_UID (lhs) + num_ssa_names))
continue;
}
else if (rhs_code == ADDR_EXPR
tree lhs = gimple_assign_lhs (stmt);
if (bitmap_bit_p (si->va_list_escape_vars,
- DECL_UID (SSA_NAME_VAR (lhs))))
+ SSA_NAME_VERSION (lhs)))
continue;
}
}
break;
}
- bitmap_set_bit (si.va_list_vars, DECL_UID (ap));
+ bitmap_set_bit (si.va_list_vars, DECL_UID (ap) + num_ssa_names);
/* VA_START_BB and VA_START_AP will be only used if there is just
one va_start in the function. */
/* If VAR is a default definition of a parameter, the variable can
take any value in VAR's type. */
- sym = SSA_NAME_VAR (var);
if (SSA_NAME_IS_DEFAULT_DEF (var))
{
+ sym = SSA_NAME_VAR (var);
if (TREE_CODE (sym) == PARM_DECL)
{
/* Try to use the "nonnull" attribute to create ~[0, 0]
bool
needs_to_live_in_memory (const_tree t)
{
- if (TREE_CODE (t) == SSA_NAME)
- t = SSA_NAME_VAR (t);
-
return (TREE_ADDRESSABLE (t)
|| is_global_var (t)
|| (TREE_CODE (t) == RESULT_DECL
tree result = gimple_call_lhs (icall_stmt);
gimple phi = create_phi_node (result, join_bb);
gimple_call_set_lhs (icall_stmt,
- make_ssa_name (SSA_NAME_VAR (result), icall_stmt));
+ duplicate_ssa_name (result, icall_stmt));
add_phi_arg (phi, gimple_call_lhs (icall_stmt), e_ij, UNKNOWN_LOCATION);
gimple_call_set_lhs (dcall_stmt,
- make_ssa_name (SSA_NAME_VAR (result), dcall_stmt));
+ duplicate_ssa_name (result, dcall_stmt));
add_phi_arg (phi, gimple_call_lhs (dcall_stmt), e_dj, UNKNOWN_LOCATION);
}
tree result = gimple_call_lhs (vcall_stmt);
gimple phi = create_phi_node (result, join_bb);
gimple_call_set_lhs (vcall_stmt,
- make_ssa_name (SSA_NAME_VAR (result), vcall_stmt));
+ duplicate_ssa_name (result, vcall_stmt));
add_phi_arg (phi, gimple_call_lhs (vcall_stmt), e_vj, UNKNOWN_LOCATION);
gimple_call_set_lhs (icall_stmt,
- make_ssa_name (SSA_NAME_VAR (result), icall_stmt));
+ duplicate_ssa_name (result, icall_stmt));
add_phi_arg (phi, gimple_call_lhs (icall_stmt), e_ij, UNKNOWN_LOCATION);
}