Commit dce2b2f6 by Richard Guenther Committed by Richard Biener

common.opt (ftree-store-ccp): Mark as preserved for backward compatibility.

2008-08-29  Richard Guenther  <rguenther@suse.de>

	* common.opt (ftree-store-ccp): Mark as preserved for
	backward compatibility.
	* doc/invoke.texi (-ftree-store-ccp): Remove documentation.
	* tree-pass.h (pass_store_ccp): Remove.
	* tree-ssa-propagate.h (struct prop_value_d): Remove mem_ref field.
	(first_vdef): Remove declaration.
	(get_value_loaded_by): Likewise.
	* tree-ssa-ccp.c (do_store_ccp): Remove.
	(get_default_value): Simplify as do_store_ccp is always false
	now.  Do not initialize mem_ref.
	(set_value_varying): Likewise.
	(canonicalize_float_value): Likewise.
	(set_lattice_value): Likewise.
	(likely_value): Likewise.
	(surely_varying_stmt_p): Likewise.
	(ccp_initialize): Likewise.
	(ccp_lattice_meet): Likewise.
	(ccp_visit_phi_node): Likewise.
	(ccp_fold): Likewise.
	(evaluate_stmt): Likewise.
	(visit_assignment): Likewise.
	(ccp_visit_stmt): Likewise.
	(execute_ssa_ccp): Fold into ...
	(do_ssa_ccp): ... this.
	(do_ssa_store_ccp): Remove.
	(gate_store_ccp): Likewise.
	(pass_store_ccp): Likewise.
	* tree-ssa-copy.c (copy_prop_visit_phi_node): Do not
	initialize mem_ref.
	* tree-ssa-propagate.c (first_vdef): Remove.
	(get_value_loaded_by): Likewise.
	(replace_vuses_in): Likewise.
	(substitute_and_fold): Do not call replace_vuses_in.
	* opts.c (decode_options): Do not set flag_tree_store_ccp.

From-SVN: r139764
parent 443aa7d5
2008-08-29 Richard Guenther <rguenther@suse.de> 2008-08-29 Richard Guenther <rguenther@suse.de>
* common.opt (ftree-store-ccp): Mark as preserved for
backward compatibility.
* doc/invoke.texi (-ftree-store-ccp): Remove documentation.
* tree-pass.h (pass_store_ccp): Remove.
* tree-ssa-propagate.h (struct prop_value_d): Remove mem_ref field.
(first_vdef): Remove declaration.
(get_value_loaded_by): Likewise.
* tree-ssa-ccp.c (do_store_ccp): Remove.
(get_default_value): Simplify as do_store_ccp is always false
now. Do not initialize mem_ref.
(set_value_varying): Likewise.
(canonicalize_float_value): Likewise.
(set_lattice_value): Likewise.
(likely_value): Likewise.
(surely_varying_stmt_p): Likewise.
(ccp_initialize): Likewise.
(ccp_lattice_meet): Likewise.
(ccp_visit_phi_node): Likewise.
(ccp_fold): Likewise.
(evaluate_stmt): Likewise.
(visit_assignment): Likewise.
(ccp_visit_stmt): Likewise.
(execute_ssa_ccp): Fold into ...
(do_ssa_ccp): ... this.
(do_ssa_store_ccp): Remove.
(gate_store_ccp): Likewise.
(pass_store_ccp): Likewise.
* tree-ssa-copy.c (copy_prop_visit_phi_node): Do not
initialize mem_ref.
* tree-ssa-propagate.c (first_vdef): Remove.
(get_value_loaded_by): Likewise.
(replace_vuses_in): Likewise.
(substitute_and_fold): Do not call replace_vuses_in.
* opts.c (decode_options): Do not set flag_tree_store_ccp.
2008-08-29 Richard Guenther <rguenther@suse.de>
PR middle-end/37236 PR middle-end/37236
* tree-ssa-structalias.c (intra_create_variable_infos): Mark * tree-ssa-structalias.c (intra_create_variable_infos): Mark
PARAM_NOALIAS tags with is_heapvar. PARAM_NOALIAS tags with is_heapvar.
......
...@@ -1111,8 +1111,8 @@ Common Report Var(flag_tree_ccp) Optimization ...@@ -1111,8 +1111,8 @@ Common Report Var(flag_tree_ccp) Optimization
Enable SSA-CCP optimization on trees Enable SSA-CCP optimization on trees
ftree-store-ccp ftree-store-ccp
Common Report Var(flag_tree_store_ccp) Optimization Common
Enable SSA-CCP optimization for stores and loads Does nothing. Preserved for backward compatibility.
ftree-ch ftree-ch
Common Report Var(flag_tree_ch) Optimization Common Report Var(flag_tree_ch) Optimization
......
...@@ -365,7 +365,7 @@ Objective-C and Objective-C++ Dialects}. ...@@ -365,7 +365,7 @@ Objective-C and Objective-C++ Dialects}.
-ftree-loop-distribution @gol -ftree-loop-distribution @gol
-ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
-ftree-parallelize-loops=@var{n} -ftree-pre -ftree-reassoc @gol -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-reassoc @gol
-ftree-sink -ftree-sra -ftree-store-ccp -ftree-switch-conversion @gol -ftree-sink -ftree-sra -ftree-switch-conversion @gol
-ftree-ter -ftree-vect-loop-version -ftree-vectorize -ftree-vrp @gol -ftree-ter -ftree-vect-loop-version -ftree-vectorize -ftree-vrp @gol
-funit-at-a-time -funroll-all-loops -funroll-loops @gol -funit-at-a-time -funroll-all-loops -funroll-loops @gol
-funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol -funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol
...@@ -5938,13 +5938,6 @@ Perform sparse conditional constant propagation (CCP) on trees. This ...@@ -5938,13 +5938,6 @@ Perform sparse conditional constant propagation (CCP) on trees. This
pass only operates on local scalar variables and is enabled by default pass only operates on local scalar variables and is enabled by default
at @option{-O} and higher. at @option{-O} and higher.
@item -ftree-store-ccp
@opindex ftree-store-ccp
Perform sparse conditional constant propagation (CCP) on trees. This
pass operates on both local scalar variables and memory stores and
loads (global variables, structures, arrays, etc). This flag is
enabled by default at @option{-O2} and higher.
@item -ftree-switch-conversion @item -ftree-switch-conversion
Perform conversion of simple initializations in a switch to Perform conversion of simple initializations in a switch to
initializations from a scalar array. This flag is enabled by default initializations from a scalar array. This flag is enabled by default
......
...@@ -951,14 +951,13 @@ decode_options (unsigned int argc, const char **argv) ...@@ -951,14 +951,13 @@ decode_options (unsigned int argc, const char **argv)
flag_delete_null_pointer_checks = opt2; flag_delete_null_pointer_checks = opt2;
flag_reorder_blocks = opt2; flag_reorder_blocks = opt2;
flag_reorder_functions = opt2; flag_reorder_functions = opt2;
flag_tree_store_ccp = opt2;
flag_tree_vrp = opt2; flag_tree_vrp = opt2;
flag_tree_builtin_call_dce = opt2; flag_tree_builtin_call_dce = opt2;
flag_tree_pre = opt2; flag_tree_pre = opt2;
flag_tree_switch_conversion = 1; flag_tree_switch_conversion = 1;
flag_ipa_cp = opt2; flag_ipa_cp = opt2;
/* Allow more virtual operators to increase alias precision. */ /* Allow more virtual operators to increase alias precision. */
set_param_value ("max-aliased-vops", set_param_value ("max-aliased-vops",
(opt2) ? 500 : initial_max_aliased_vops); (opt2) ? 500 : initial_max_aliased_vops);
......
...@@ -380,7 +380,6 @@ extern struct gimple_opt_pass pass_fre; ...@@ -380,7 +380,6 @@ extern struct gimple_opt_pass pass_fre;
extern struct gimple_opt_pass pass_linear_transform; extern struct gimple_opt_pass pass_linear_transform;
extern struct gimple_opt_pass pass_check_data_deps; extern struct gimple_opt_pass pass_check_data_deps;
extern struct gimple_opt_pass pass_copy_prop; extern struct gimple_opt_pass pass_copy_prop;
extern struct gimple_opt_pass pass_store_ccp;
extern struct gimple_opt_pass pass_vrp; extern struct gimple_opt_pass pass_vrp;
extern struct gimple_opt_pass pass_uncprop; extern struct gimple_opt_pass pass_uncprop;
extern struct gimple_opt_pass pass_return_slot; extern struct gimple_opt_pass pass_return_slot;
......
...@@ -829,7 +829,7 @@ copy_prop_visit_phi_node (gimple phi) ...@@ -829,7 +829,7 @@ copy_prop_visit_phi_node (gimple phi)
{ {
enum ssa_prop_result retval; enum ssa_prop_result retval;
unsigned i; unsigned i;
prop_value_t phi_val = { 0, NULL_TREE, NULL_TREE }; prop_value_t phi_val = { 0, NULL_TREE };
tree lhs = gimple_phi_result (phi); tree lhs = gimple_phi_result (phi);
......
...@@ -823,22 +823,6 @@ ssa_propagate (ssa_prop_visit_stmt_fn visit_stmt, ...@@ -823,22 +823,6 @@ ssa_propagate (ssa_prop_visit_stmt_fn visit_stmt,
} }
/* Return the first VDEF operand for STMT. */
tree
first_vdef (gimple stmt)
{
ssa_op_iter iter;
tree op;
/* Simply return the first operand we arrive at. */
FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_VIRTUAL_DEFS)
return (op);
gcc_unreachable ();
}
/* Return true if STMT is of the form 'LHS = mem_ref', where 'mem_ref' /* Return true if STMT is of the form 'LHS = mem_ref', where 'mem_ref'
is a non-volatile pointer dereference, a structure reference or a is a non-volatile pointer dereference, a structure reference or a
reference to a single _DECL. Ignore volatile memory references reference to a single _DECL. Ignore volatile memory references
...@@ -898,30 +882,6 @@ stmt_makes_single_store (gimple stmt) ...@@ -898,30 +882,6 @@ stmt_makes_single_store (gimple stmt)
} }
/* If STMT makes a single memory load and all the virtual use operands
have the same value in array VALUES, return it. Otherwise, return
NULL. */
prop_value_t *
get_value_loaded_by (gimple stmt, prop_value_t *values)
{
ssa_op_iter i;
tree vuse;
prop_value_t *prev_val = NULL;
prop_value_t *val = NULL;
FOR_EACH_SSA_TREE_OPERAND (vuse, stmt, i, SSA_OP_VIRTUAL_USES)
{
val = &values[SSA_NAME_VERSION (vuse)];
if (prev_val && prev_val->value != val->value)
return NULL;
prev_val = val;
}
return val;
}
/* Propagation statistics. */ /* Propagation statistics. */
struct prop_stats_d struct prop_stats_d
{ {
...@@ -972,131 +932,6 @@ replace_uses_in (gimple stmt, prop_value_t *prop_value) ...@@ -972,131 +932,6 @@ replace_uses_in (gimple stmt, prop_value_t *prop_value)
} }
/* Replace the VUSE references in statement STMT with the values
stored in PROP_VALUE. Return true if a reference was replaced.
Replacing VUSE operands is slightly more complex than replacing
regular USEs. We are only interested in two types of replacements
here:
1- If the value to be replaced is a constant or an SSA name for a
GIMPLE register, then we are making a copy/constant propagation
from a memory store. For instance,
# a_3 = VDEF <a_2>
a.b = x_1;
...
# VUSE <a_3>
y_4 = a.b;
This replacement is only possible iff STMT is an assignment
whose RHS is identical to the LHS of the statement that created
the VUSE(s) that we are replacing. Otherwise, we may do the
wrong replacement:
# a_3 = VDEF <a_2>
# b_5 = VDEF <b_4>
*p = 10;
...
# VUSE <b_5>
x_8 = b;
Even though 'b_5' acquires the value '10' during propagation,
there is no way for the propagator to tell whether the
replacement is correct in every reached use, because values are
computed at definition sites. Therefore, when doing final
substitution of propagated values, we have to check each use
site. Since the RHS of STMT ('b') is different from the LHS of
the originating statement ('*p'), we cannot replace 'b' with
'10'.
Similarly, when merging values from PHI node arguments,
propagators need to take care not to merge the same values
stored in different locations:
if (...)
# a_3 = VDEF <a_2>
a.b = 3;
else
# a_4 = VDEF <a_2>
a.c = 3;
# a_5 = PHI <a_3, a_4>
It would be wrong to propagate '3' into 'a_5' because that
operation merges two stores to different memory locations.
2- If the value to be replaced is an SSA name for a virtual
register, then we simply replace each VUSE operand with its
value from PROP_VALUE. This is the same replacement done by
replace_uses_in. */
static bool
replace_vuses_in (gimple stmt, prop_value_t *prop_value)
{
bool replaced = false;
ssa_op_iter iter;
use_operand_p vuse;
if (stmt_makes_single_load (stmt))
{
/* If STMT is an assignment whose RHS is a single memory load,
see if we are trying to propagate a constant or a GIMPLE
register (case #1 above). */
prop_value_t *val = get_value_loaded_by (stmt, prop_value);
tree rhs = gimple_assign_rhs1 (stmt);
if (val
&& val->value
&& (is_gimple_reg (val->value)
|| is_gimple_min_invariant (val->value))
&& simple_cst_equal (rhs, val->mem_ref) == 1)
{
/* We can only perform the substitution if the load is done
from the same memory location as the original store.
Since we already know that there are no intervening
stores between DEF_STMT and STMT, we only need to check
that the RHS of STMT is the same as the memory reference
propagated together with the value. */
gimple_assign_set_rhs1 (stmt, val->value);
if (TREE_CODE (val->value) != SSA_NAME)
prop_stats.num_const_prop++;
else
prop_stats.num_copy_prop++;
/* Since we have replaced the whole RHS of STMT, there
is no point in checking the other VUSEs, as they will
all have the same value. */
return true;
}
}
/* Otherwise, the values for every VUSE operand must be other
SSA_NAMEs that can be propagated into STMT. */
FOR_EACH_SSA_USE_OPERAND (vuse, stmt, iter, SSA_OP_VIRTUAL_USES)
{
tree var = USE_FROM_PTR (vuse);
tree val = prop_value[SSA_NAME_VERSION (var)].value;
if (val == NULL_TREE || var == val)
continue;
/* Constants and copies propagated between real and virtual
operands are only possible in the cases handled above. They
should be ignored in any other context. */
if (is_gimple_min_invariant (val) || is_gimple_reg (val))
continue;
propagate_value (vuse, val);
prop_stats.num_copy_prop++;
replaced = true;
}
return replaced;
}
/* Replace propagated values into all the arguments for PHI using the /* Replace propagated values into all the arguments for PHI using the
values from PROP_VALUE. */ values from PROP_VALUE. */
...@@ -1321,17 +1156,11 @@ substitute_and_fold (prop_value_t *prop_value, bool use_ranges_p) ...@@ -1321,17 +1156,11 @@ substitute_and_fold (prop_value_t *prop_value, bool use_ranges_p)
gcc_assert (gsi_stmt (i) == stmt); gcc_assert (gsi_stmt (i) == stmt);
} }
if (prop_value) /* Only replace real uses if we couldn't fold the
{ statement using value range information. */
/* Only replace real uses if we couldn't fold the if (prop_value
statement using value range information (value range && !did_replace)
information is not collected on virtuals, so we only did_replace |= replace_uses_in (stmt, prop_value);
need to check this for real uses). */
if (!did_replace)
did_replace |= replace_uses_in (stmt, prop_value);
did_replace |= replace_vuses_in (stmt, prop_value);
}
/* If we made a replacement, fold and cleanup the statement. */ /* If we made a replacement, fold and cleanup the statement. */
if (did_replace) if (did_replace)
......
...@@ -69,16 +69,6 @@ struct prop_value_d { ...@@ -69,16 +69,6 @@ struct prop_value_d {
/* Propagated value. */ /* Propagated value. */
tree value; tree value;
/* If this value is held in an SSA name for a non-register
variable, this field holds the actual memory reference
associated with this value. This field is taken from
the LHS of the assignment that generated the associated SSA
name. However, in the case of PHI nodes, this field is copied
from the PHI arguments (assuming that all the arguments have
the same memory reference). See replace_vuses_in for a more
detailed description. */
tree mem_ref;
}; };
typedef struct prop_value_d prop_value_t; typedef struct prop_value_d prop_value_t;
...@@ -128,10 +118,8 @@ bool valid_gimple_rhs_p (tree); ...@@ -128,10 +118,8 @@ bool valid_gimple_rhs_p (tree);
bool valid_gimple_call_p (tree); bool valid_gimple_call_p (tree);
void move_ssa_defining_stmt_for_defs (gimple, gimple); void move_ssa_defining_stmt_for_defs (gimple, gimple);
bool update_call_from_tree (gimple_stmt_iterator *, tree); bool update_call_from_tree (gimple_stmt_iterator *, tree);
tree first_vdef (gimple);
bool stmt_makes_single_load (gimple); bool stmt_makes_single_load (gimple);
bool stmt_makes_single_store (gimple); bool stmt_makes_single_store (gimple);
prop_value_t *get_value_loaded_by (gimple, prop_value_t *);
bool substitute_and_fold (prop_value_t *, bool); bool substitute_and_fold (prop_value_t *, bool);
#endif /* _TREE_SSA_PROPAGATE_H */ #endif /* _TREE_SSA_PROPAGATE_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment