Commit d092f0f6 by Zdenek Dvorak Committed by Zdenek Dvorak

tree-ssa-alias.c (new_type_alias): Do not use offset of expr to select subvars of var.

	* tree-ssa-alias.c (new_type_alias): Do not use offset of expr to
	select subvars of var.

From-SVN: r118924
parent c7b38a85
2006-11-17 Zdenek Dvorak <dvorakz@suse.cz>
* tree-ssa-alias.c (new_type_alias): Do not use offset of expr to
select subvars of var.
2006-11-17 Jakub Jelinek <jakub@redhat.com> 2006-11-17 Jakub Jelinek <jakub@redhat.com>
PR middle-end/29584 PR middle-end/29584
......
...@@ -2755,6 +2755,9 @@ new_type_alias (tree ptr, tree var, tree expr) ...@@ -2755,6 +2755,9 @@ new_type_alias (tree ptr, tree var, tree expr)
tree ali = NULL_TREE; tree ali = NULL_TREE;
HOST_WIDE_INT offset, size, maxsize; HOST_WIDE_INT offset, size, maxsize;
tree ref; tree ref;
VEC (tree, heap) *overlaps = NULL;
subvar_t sv;
unsigned int len;
gcc_assert (p_ann->symbol_mem_tag == NULL_TREE); gcc_assert (p_ann->symbol_mem_tag == NULL_TREE);
gcc_assert (!MTAG_P (var)); gcc_assert (!MTAG_P (var));
...@@ -2767,13 +2770,9 @@ new_type_alias (tree ptr, tree var, tree expr) ...@@ -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 /* 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. */ subvars, add the subvars to the tag instead of the actual var. */
if (var_can_have_subvars (var) if (var_can_have_subvars (ref)
&& (svars = get_subvars_for_var (var))) && (svars = get_subvars_for_var (ref)))
{ {
subvar_t sv;
VEC (tree, heap) *overlaps = NULL;
unsigned int len;
for (sv = svars; sv; sv = sv->next) for (sv = svars; sv; sv = sv->next)
{ {
bool exact; bool exact;
...@@ -2781,15 +2780,36 @@ new_type_alias (tree ptr, tree var, tree expr) ...@@ -2781,15 +2780,36 @@ new_type_alias (tree ptr, tree var, tree expr)
if (overlap_subvar (offset, maxsize, sv->var, &exact)) if (overlap_subvar (offset, maxsize, sv->var, &exact))
VEC_safe_push (tree, heap, overlaps, sv->var); 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)) if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "\nnumber of overlapping subvars = %u\n", len); fprintf (dump_file, "\nnumber of overlapping subvars = %u\n", len);
gcc_assert (len);
if (len == 1) 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) else if (len > 1)
{ {
unsigned int k; unsigned int k;
tree sv_var; tree sv_var;
...@@ -2807,9 +2827,8 @@ new_type_alias (tree ptr, tree var, tree expr) ...@@ -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; p_ann->symbol_mem_tag = ali;
TREE_READONLY (tag) = TREE_READONLY (var); TREE_READONLY (tag) = TREE_READONLY (var);
......
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