diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-08-04 12:29:48 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-08-04 12:29:48 +0000 |
commit | 14f101cffa72ffaa29995b1e6a3597c676a7882a (patch) | |
tree | 44d87dd02a78032816f3cb81e0405f29ab9570c6 /gcc/tree-ssa-copy.c | |
parent | 459a1bdc1386060a2ca9d65c7f03c401001d1ee7 (diff) | |
download | gcc-14f101cffa72ffaa29995b1e6a3597c676a7882a.tar.gz |
2010-08-04 Richard Guenther <rguenther@suse.de>
* tree-ssa-propagate.h (struct prop_value_d, prop_value_t): Move ...
* tree-ssa-ccp.c: ... here.
* tree-ssa-copy.c: ... and here.
* tree-ssa-propagate.h (enum value_range_type, struct value_range_d,
value_range_t): Move ...
* tree-vrp.c: ... here.
* tree-ssa-propagate.h (ssa_prop_get_value_fn): New typedef.
(substitute_and_fold): Adjust prototype.
* tree-ssa-propagate.c (replace_uses_in): Adjust.
(replace_phi_args_in): Likewise.
(substitute_and_fold): Take callback to query lattice instead
of pointer to lattice. Replace SSA name defs with lattice
values first.
* tree-ssa-ccp.c (ccp_finalize): Adjust.
* tree-ssa-copy.c (copy_prop_visit_phi_node): Adjust.
(get_value): New function.
(fini_copy_prop): Adjust.
* tree-vrp.c (vrp_finalize): Adjust.
* gcc.dg/tree-ssa/vrp35.c: Adjust.
* gcc.dg/tree-ssa/vrp36.c: Likewise.
* gcc.dg/tree-ssa/vrp50.c: Likewise.
* gcc.dg/tree-ssa/vrp52.c: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162864 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-copy.c')
-rw-r--r-- | gcc/tree-ssa-copy.c | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c index 87d896842f9..767e18328d4 100644 --- a/gcc/tree-ssa-copy.c +++ b/gcc/tree-ssa-copy.c @@ -285,6 +285,14 @@ propagate_tree_value_into_stmt (gimple_stmt_iterator *gsi, tree val) After propagation, the copy-of value for each variable X_i is converted into the final value by walking the copy-of chains and updating COPY_OF[i].VALUE to be the last element of the chain. */ + +struct prop_value_d { + /* Copy-of value. */ + tree value; +}; + +typedef struct prop_value_d prop_value_t; + static prop_value_t *copy_of; /* Used in set_copy_of_val to determine if the last link of a copy-of @@ -626,7 +634,7 @@ copy_prop_visit_phi_node (gimple phi) { enum ssa_prop_result retval; unsigned i; - prop_value_t phi_val = { 0, NULL_TREE }; + prop_value_t phi_val = { NULL_TREE }; tree lhs = gimple_phi_result (phi); @@ -818,6 +826,16 @@ init_copy_prop (void) } } +/* Callback for substitute_and_fold to get at the final copy-of values. */ + +static tree +get_value (tree name) +{ + tree val = copy_of[SSA_NAME_VERSION (name)].value; + if (val && val != name) + return val; + return NULL_TREE; +} /* Deallocate memory used in copy propagation and do final substitution. */ @@ -825,12 +843,10 @@ init_copy_prop (void) static void fini_copy_prop (void) { - size_t i; - prop_value_t *tmp; + unsigned i; /* Set the final copy-of value for each variable by traversing the copy-of chains. */ - tmp = XCNEWVEC (prop_value_t, num_ssa_names); for (i = 1; i < num_ssa_names; i++) { tree var = ssa_name (i); @@ -839,7 +855,7 @@ fini_copy_prop (void) || copy_of[i].value == var) continue; - tmp[i].value = get_last_copy_of (var); + copy_of[i].value = get_last_copy_of (var); /* In theory the points-to solution of all members of the copy chain is their intersection. For now we do not bother @@ -847,18 +863,17 @@ fini_copy_prop (void) information completely by setting the points-to solution of the representative to the first solution we find if it doesn't have one already. */ - if (tmp[i].value != var + if (copy_of[i].value != var && POINTER_TYPE_P (TREE_TYPE (var)) && SSA_NAME_PTR_INFO (var) - && !SSA_NAME_PTR_INFO (tmp[i].value)) - duplicate_ssa_name_ptr_info (tmp[i].value, SSA_NAME_PTR_INFO (var)); + && !SSA_NAME_PTR_INFO (copy_of[i].value)) + duplicate_ssa_name_ptr_info (copy_of[i].value, SSA_NAME_PTR_INFO (var)); } - substitute_and_fold (tmp, NULL, true); + substitute_and_fold (get_value, NULL, true); free (cached_last_copy_of); free (copy_of); - free (tmp); } |