summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-alias.c
diff options
context:
space:
mode:
authorrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2006-11-17 09:24:01 +0000
committerrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2006-11-17 09:24:01 +0000
commit2520aaad1582b21f82ea4c56d793c39302a7c394 (patch)
tree6417ae015c1813c152e394028dcb7622bc2cebad /gcc/tree-ssa-alias.c
parentc5237b8b8ece31f3f1a076d06460178710b90fae (diff)
downloadgcc-2520aaad1582b21f82ea4c56d793c39302a7c394.tar.gz
* tree-ssa-alias.c (new_type_alias): Do not use offset of expr to
select subvars of var. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@118924 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-alias.c')
-rw-r--r--gcc/tree-ssa-alias.c45
1 files changed, 32 insertions, 13 deletions
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index 18db998ec66..275c2449a0d 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -2755,6 +2755,9 @@ new_type_alias (tree ptr, tree var, tree expr)
tree ali = NULL_TREE;
HOST_WIDE_INT offset, size, maxsize;
tree ref;
+ VEC (tree, heap) *overlaps = NULL;
+ subvar_t sv;
+ unsigned int len;
gcc_assert (p_ann->symbol_mem_tag == NULL_TREE);
gcc_assert (!MTAG_P (var));
@@ -2767,13 +2770,9 @@ new_type_alias (tree ptr, tree var, tree expr)
/* Add VAR to the may-alias set of PTR's new symbol 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)))
+ if (var_can_have_subvars (ref)
+ && (svars = get_subvars_for_var (ref)))
{
- subvar_t sv;
- VEC (tree, heap) *overlaps = NULL;
- unsigned int len;
-
for (sv = svars; sv; sv = sv->next)
{
bool exact;
@@ -2781,15 +2780,36 @@ new_type_alias (tree ptr, tree var, tree expr)
if (overlap_subvar (offset, maxsize, sv->var, &exact))
VEC_safe_push (tree, heap, overlaps, sv->var);
}
- len = VEC_length (tree, overlaps);
+ gcc_assert (overlaps != NULL);
+ }
+ else if (var_can_have_subvars (var)
+ && (svars = get_subvars_for_var (var)))
+ {
+ /* If the REF is not a direct access to VAR (e.g., it is a dereference
+ of a pointer), we should scan the virtual operands of REF the same
+ way as tree-ssa-operands do. At the moment, this is somewhat
+ difficult, so we just give up and add all the subvars of VAR.
+ On mem-ssa branch, the scanning for virtual operands have been
+ split from the rest of tree-ssa-operands, so it should be much
+ easier to fix this problem correctly once mem-ssa is merged. */
+ for (sv = svars; sv; sv = sv->next)
+ VEC_safe_push (tree, heap, overlaps, sv->var);
+
+ gcc_assert (overlaps != NULL);
+ }
+ else
+ ali = add_may_alias_for_new_tag (tag, var);
+
+ len = VEC_length (tree, overlaps);
+ if (len > 0)
+ {
if (dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file, "\nnumber of overlapping subvars = %u\n", len);
- gcc_assert (len);
+ fprintf (dump_file, "\nnumber of overlapping subvars = %u\n", len);
if (len == 1)
- ali = add_may_alias_for_new_tag (tag, VEC_index (tree, overlaps, 0));
+ ali = add_may_alias_for_new_tag (tag, VEC_index (tree, overlaps, 0));
else if (len > 1)
- {
+ {
unsigned int k;
tree sv_var;
@@ -2807,9 +2827,8 @@ new_type_alias (tree ptr, tree var, tree expr)
}
}
}
+ VEC_free (tree, heap, overlaps);
}
- else
- ali = add_may_alias_for_new_tag (tag, var);
p_ann->symbol_mem_tag = ali;
TREE_READONLY (tag) = TREE_READONLY (var);