tree-call-cdce.c (check_pow): Simplify.
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. From-SVN: r190229
This commit is contained in:
parent
3b1e1a029a
commit
6b4a85ad6f
11 changed files with 71 additions and 89 deletions
|
@ -1,3 +1,26 @@
|
|||
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>
|
||||
|
||||
|
|
|
@ -8363,7 +8363,7 @@ void
|
|||
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;
|
||||
|
@ -8429,7 +8429,6 @@ gimple_regimplify_operands (gimple stmt, gimple_stmt_iterator *gsi_p)
|
|||
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);
|
||||
|
@ -8507,10 +8506,6 @@ gimple_regimplify_operands (gimple stmt, gimple_stmt_iterator *gsi_p)
|
|||
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);
|
||||
|
|
|
@ -203,7 +203,7 @@ check_pow (gimple pow_call)
|
|||
}
|
||||
else if (bc == SSA_NAME)
|
||||
{
|
||||
tree base_val0, base_var, type;
|
||||
tree base_val0, type;
|
||||
gimple base_def;
|
||||
int bit_sz;
|
||||
|
||||
|
@ -217,11 +217,7 @@ check_pow (gimple pow_call)
|
|||
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);
|
||||
|
@ -448,7 +444,7 @@ gen_conditions_for_pow_int_base (tree base, tree expn,
|
|||
{
|
||||
gimple base_def;
|
||||
tree base_val0;
|
||||
tree base_var, int_type;
|
||||
tree int_type;
|
||||
tree temp, tempn;
|
||||
tree cst0;
|
||||
gimple stmt1, stmt2;
|
||||
|
@ -457,8 +453,7 @@ gen_conditions_for_pow_int_base (tree base, tree expn,
|
|||
|
||||
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);
|
||||
|
|
|
@ -1030,13 +1030,11 @@ insert_backedge_copies (void)
|
|||
{
|
||||
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);
|
||||
|
@ -1048,7 +1046,7 @@ insert_backedge_copies (void)
|
|||
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;
|
||||
|
@ -1078,10 +1076,9 @@ insert_backedge_copies (void)
|
|||
|
||||
/* 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))
|
||||
|
|
|
@ -1008,9 +1008,7 @@ create_phi_for_local_result (void **slot, void *data)
|
|||
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);
|
||||
|
|
|
@ -2687,18 +2687,13 @@ propagate_rhs_into_lhs (gimple stmt, tree lhs, tree rhs, bitmap interesting_name
|
|||
/* 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))
|
||||
{
|
||||
|
@ -2706,14 +2701,8 @@ propagate_rhs_into_lhs (gimple stmt, tree lhs, tree rhs, bitmap interesting_name
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -126,17 +126,6 @@ static void get_expr_operands (gimple, tree *, int);
|
|||
/* 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. */
|
||||
|
||||
|
|
|
@ -266,11 +266,15 @@ find_va_list_reference (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
|
|||
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;
|
||||
}
|
||||
|
@ -347,12 +351,12 @@ va_list_counter_struct_op (struct stdarg_info *si, tree ap, tree var,
|
|||
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)
|
||||
|
@ -371,13 +375,11 @@ static bool
|
|||
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)
|
||||
|
@ -405,8 +407,8 @@ va_list_ptr_read (struct stdarg_info *si, tree ap, tree tem)
|
|||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
|
@ -423,11 +425,11 @@ va_list_ptr_write (struct stdarg_info *si, tree ap, tree tem2)
|
|||
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)
|
||||
|
@ -459,23 +461,21 @@ check_va_list_escapes (struct stdarg_info *si, tree lhs, tree rhs)
|
|||
|
||||
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;
|
||||
|
@ -511,8 +511,7 @@ check_va_list_escapes (struct stdarg_info *si, tree lhs, tree rhs)
|
|||
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));
|
||||
}
|
||||
|
||||
|
||||
|
@ -540,7 +539,7 @@ check_all_va_list_escapes (struct stdarg_info *si)
|
|||
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))
|
||||
|
@ -586,12 +585,12 @@ check_all_va_list_escapes (struct stdarg_info *si)
|
|||
|
||||
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
|
||||
|
@ -601,7 +600,7 @@ check_all_va_list_escapes (struct stdarg_info *si)
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
@ -722,7 +721,7 @@ execute_optimize_stdarg (void)
|
|||
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. */
|
||||
|
|
|
@ -718,9 +718,9 @@ get_value_range (const_tree var)
|
|||
|
||||
/* 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]
|
||||
|
|
|
@ -10155,9 +10155,6 @@ range_in_array_bounds_p (tree ref)
|
|||
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
|
||||
|
|
|
@ -1276,10 +1276,10 @@ gimple_ic (gimple icall_stmt, struct cgraph_node *direct_call,
|
|||
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);
|
||||
}
|
||||
|
||||
|
@ -1507,10 +1507,10 @@ gimple_stringop_fixed_value (gimple vcall_stmt, tree icall_size, int prob,
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue