aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2008-04-23 14:06:02 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2008-04-23 14:06:02 +0000
commita7a512beff448f28fc2f9f192e19e30cbf971eba (patch)
tree92b446ae6c5a7e1732e139eb7761d3c20bb21399
parentf3f75f693d12f58acbb37d393280081621eb3f58 (diff)
downloadgcc-a7a512beff448f28fc2f9f192e19e30cbf971eba.zip
gcc-a7a512beff448f28fc2f9f192e19e30cbf971eba.tar.gz
gcc-a7a512beff448f28fc2f9f192e19e30cbf971eba.tar.bz2
alias.c (alias_set_subset_of): Correctly handle asking if zero is a subset of an alias set with zero child.
2008-04-23 Richard Guenther <rguenther@suse.de> * alias.c (alias_set_subset_of): Correctly handle asking if zero is a subset of an alias set with zero child. * tree-ssa-alias.c (have_common_aliases_p): Simplify logic. (compute_flow_insensitive_aliasing): Correctly walk all pointers. Do not unnecessarily union sets. From-SVN: r134597
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/alias.c5
-rw-r--r--gcc/tree-ssa-alias.c22
3 files changed, 18 insertions, 17 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f0fb840..a774a43 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,13 @@
2008-04-23 Richard Guenther <rguenther@suse.de>
+ * alias.c (alias_set_subset_of): Correctly handle asking
+ if zero is a subset of an alias set with zero child.
+ * tree-ssa-alias.c (have_common_aliases_p): Simplify logic.
+ (compute_flow_insensitive_aliasing): Correctly walk all
+ pointers. Do not unnecessarily union sets.
+
+2008-04-23 Richard Guenther <rguenther@suse.de>
+
PR middle-end/36021
* c-common.c (handle_alloc_size_attribute): Use type_num_arguments.
diff --git a/gcc/alias.c b/gcc/alias.c
index 2e4f5ae..7b14f26 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -305,8 +305,9 @@ alias_set_subset_of (alias_set_type set1, alias_set_type set2)
/* Otherwise, check if set1 is a subset of set2. */
ase = get_alias_set_entry (set2);
if (ase != 0
- && (splay_tree_lookup (ase->children,
- (splay_tree_key) set1)))
+ && ((ase->has_zero_child && set1 == 0)
+ || splay_tree_lookup (ase->children,
+ (splay_tree_key) set1)))
return true;
return false;
}
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index a9ae29f..eb57010 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -2390,9 +2390,7 @@ have_common_aliases_p (bitmap tag1aliases, bitmap tag2aliases)
/* This is the old behavior of have_common_aliases_p, which is to
return false if both sets are empty, or one set is and the other
isn't. */
- if ((tag1aliases == NULL && tag2aliases != NULL)
- || (tag2aliases == NULL && tag1aliases != NULL)
- || (tag1aliases == NULL && tag2aliases == NULL))
+ if (tag1aliases == NULL || tag2aliases == NULL)
return false;
return bitmap_intersect_p (tag1aliases, tag2aliases);
@@ -2490,12 +2488,16 @@ compute_flow_insensitive_aliasing (struct alias_info *ai)
if (PTR_IS_REF_ALL (p_map1->var))
continue;
- for (j = i + 1; j < ai->num_pointers; j++)
+ for (j = 0; j < ai->num_pointers; j++)
{
struct alias_map_d *p_map2 = ai->pointers[j];
tree tag2 = symbol_mem_tag (p_map2->var);
bitmap may_aliases2 = may_aliases (tag2);
+ /* By convention tags don't alias themselves. */
+ if (tag1 == tag2)
+ continue;
+
if (PTR_IS_REF_ALL (p_map2->var))
continue;
@@ -2508,18 +2510,8 @@ compute_flow_insensitive_aliasing (struct alias_info *ai)
if (have_common_aliases_p (may_aliases1, may_aliases2))
continue;
- if (may_aliases2 && !bitmap_empty_p (may_aliases2))
- {
- union_alias_set_into (tag1, may_aliases2);
- }
- else
- {
- /* Since TAG2 does not have any aliases of its own, add
- TAG2 itself to the alias set of TAG1. */
- add_may_alias (tag1, tag2);
- }
+ add_may_alias (tag1, tag2);
}
-
}
timevar_pop (TV_FLOW_INSENSITIVE);
}