diff options
author | Keith Besaw <kbesaw@us.ibm.com> | 2005-06-10 17:44:22 +0000 |
---|---|---|
committer | Dorit Nuzman <dorit@gcc.gnu.org> | 2005-06-10 17:44:22 +0000 |
commit | 51540eba26906f4d395187d65d0627494a9aaccd (patch) | |
tree | dd8b83235bd417bca6942c0d14e7545203367143 /gcc | |
parent | 73042643c746f696cc5543005060b70dec76c8c9 (diff) | |
download | gcc-51540eba26906f4d395187d65d0627494a9aaccd.zip gcc-51540eba26906f4d395187d65d0627494a9aaccd.tar.gz gcc-51540eba26906f4d395187d65d0627494a9aaccd.tar.bz2 |
tree-ssa-alias.c (new_type_alias): Use existing type tag if VAR has just one in its may_aliases list.
2005-06-10 Keith Besaw <kbesaw@us.ibm.com>
* tree-ssa-alias.c (new_type_alias): Use existing type
tag if VAR has just one in its may_aliases list.
From-SVN: r100824
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/tree-ssa-alias.c | 48 |
2 files changed, 46 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 78bd82a..3acacf3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2005-06-10 Keith Besaw <kbesaw@us.ibm.com> + + * tree-ssa-alias.c (new_type_alias): Use existing type + tag if VAR has just one in its may_aliases list. + 2005-06-10 Fariborz Jahanian <fjahanian@apple.com> * rs6000/predicates.md (scc_operand): New. * rs6000/rs6000.md : Use scc_operand for eq:SI compares. diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 3e885e9..3098549 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -2787,8 +2787,11 @@ found_tag: } -/* Create a type tag for PTR. Construct the may-alias list of this type tag - so that it has the aliasing of VAR. */ +/* Create a new type tag for PTR. Construct the may-alias list of this type + tag so that it has the aliasing of VAR. + + Note, the set of aliases represented by the new type tag are not marked + for renaming. */ void new_type_alias (tree ptr, tree var) @@ -2801,22 +2804,53 @@ new_type_alias (tree ptr, tree var) gcc_assert (p_ann->type_mem_tag == NULL_TREE); gcc_assert (v_ann->mem_tag_kind == NOT_A_TAG); - tag = create_memory_tag (tag_type, true); - p_ann->type_mem_tag = tag; /* Add VAR to the may-alias set of PTR's new type tag. If VAR has subvars, add the subvars to the tag instead of the actual var. */ if (var_can_have_subvars (var) && (svars = get_subvars_for_var (var))) { - subvar_t sv; + subvar_t sv; + + tag = create_memory_tag (tag_type, true); + p_ann->type_mem_tag = tag; + for (sv = svars; sv; sv = sv->next) add_may_alias (tag, sv->var); } else - add_may_alias (tag, var); + { + /* The following is based on code in add_stmt_operand to ensure that the + same defs/uses/vdefs/vuses will be found after replacing a reference + to var (or ARRAY_REF to var) with an INDIRECT_REF to ptr whose value + is the address of var. */ + varray_type aliases = v_ann->may_aliases; + + if ((aliases != NULL) + && (VARRAY_ACTIVE_SIZE (aliases) == 1)) + { + tree ali = VARRAY_TREE (aliases, 0); - /* Note, TAG and its set of aliases are not marked for renaming. */ + if (get_var_ann (ali)->mem_tag_kind == TYPE_TAG) + { + p_ann->type_mem_tag = ali; + return; + } + } + + tag = create_memory_tag (tag_type, true); + p_ann->type_mem_tag = tag; + + if (aliases == NULL) + add_may_alias (tag, var); + else + { + size_t i; + + for (i = 0; i < VARRAY_ACTIVE_SIZE (aliases); i++) + add_may_alias (tag, VARRAY_TREE (aliases, i)); + } + } } /* This represents the used range of a variable. */ |