aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-alias.c
diff options
context:
space:
mode:
authorDiego Novillo <dnovillo@redhat.com>2005-04-11 22:06:46 +0000
committerDiego Novillo <dnovillo@gcc.gnu.org>2005-04-11 18:06:46 -0400
commitf8d66d34f711e94a48b1eb28ab0fa25c6e1404c9 (patch)
treeea3a6eedbf40f8febad0a55f21fd8d5f0af2123d /gcc/tree-ssa-alias.c
parent9f32d037484306f1045b661d9bf29e893d846ede (diff)
downloadgcc-f8d66d34f711e94a48b1eb28ab0fa25c6e1404c9.zip
gcc-f8d66d34f711e94a48b1eb28ab0fa25c6e1404c9.tar.gz
gcc-f8d66d34f711e94a48b1eb28ab0fa25c6e1404c9.tar.bz2
re PR middle-end/20933 (gcc can no longer bootstrap itself)
PR tree-optimization/20933 * tree-ssa-alias.c (compute_flow_insensitive_aliasing): Move logic to reject aliases between read-only and writable variables ... (may_alias_p): ... here. (get_tmt_for): Do not associate read-only tags to pointers whose pointed-to type is not read-only. * tree-ssa.c (verify_ssa): Check that memory stores have at least one V_MAY_DEF or V_MUST_DEF. testsuite/ChangeLog PR tree-optimization/20933 * gcc.dg/tree-ssa/pr20933.c: New test. From-SVN: r97988
Diffstat (limited to 'gcc/tree-ssa-alias.c')
-rw-r--r--gcc/tree-ssa-alias.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index 7d8e783..c0bce92 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -1001,10 +1001,6 @@ compute_flow_insensitive_aliasing (struct alias_info *ai)
if (!tag_stored_p && !var_stored_p)
continue;
- if ((unmodifiable_var_p (tag) && !unmodifiable_var_p (var))
- || (unmodifiable_var_p (var) && !unmodifiable_var_p (tag)))
- continue;
-
if (may_alias_p (p_map->var, p_map->set, var, v_map->set))
{
subvar_t svars;
@@ -1719,6 +1715,16 @@ may_alias_p (tree ptr, HOST_WIDE_INT mem_alias_set,
return false;
}
+ /* If either MEM or VAR is a read-only global and the other one
+ isn't, then PTR cannot point to VAR. */
+ if ((unmodifiable_var_p (mem) && !unmodifiable_var_p (var))
+ || (unmodifiable_var_p (var) && !unmodifiable_var_p (mem)))
+ {
+ alias_stats.alias_noalias++;
+ alias_stats.simple_resolved++;
+ return false;
+ }
+
m_ann = var_ann (mem);
gcc_assert (m_ann->mem_tag_kind == TYPE_TAG);
@@ -2319,9 +2325,11 @@ get_tmt_for (tree ptr, struct alias_info *ai)
for (i = 0, tag = NULL_TREE; i < ai->num_pointers; i++)
{
struct alias_map_d *curr = ai->pointers[i];
- if (tag_set == curr->set)
+ tree curr_tag = var_ann (curr->var)->type_mem_tag;
+ if (tag_set == curr->set
+ && TYPE_READONLY (tag_type) == TYPE_READONLY (TREE_TYPE (curr_tag)))
{
- tag = var_ann (curr->var)->type_mem_tag;
+ tag = curr_tag;
break;
}
}
@@ -2356,6 +2364,10 @@ get_tmt_for (tree ptr, struct alias_info *ai)
pointed-to type. */
gcc_assert (tag_set == get_alias_set (tag));
+ /* If PTR's pointed-to type is read-only, then TAG's type must also
+ be read-only. */
+ gcc_assert (TYPE_READONLY (tag_type) == TYPE_READONLY (TREE_TYPE (tag)));
+
return tag;
}