aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2019-05-31 16:16:27 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2019-05-31 14:16:27 +0000
commit1facd6278b85e2866b487b72c1f5f671c5ae9e4a (patch)
tree497c78a95c21f907ff88c9deac8dba1033b38f42 /gcc
parentff0b7e883d9f09785c92ab41fa32fa093b60b346 (diff)
downloadgcc-1facd6278b85e2866b487b72c1f5f671c5ae9e4a.zip
gcc-1facd6278b85e2866b487b72c1f5f671c5ae9e4a.tar.gz
gcc-1facd6278b85e2866b487b72c1f5f671c5ae9e4a.tar.bz2
tree-ssa-alias.c (type_has_components_p): New function.
* tree-ssa-alias.c (type_has_components_p): New function. (aliasing_component_refs_p): Use it. From-SVN: r271813
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/tree-ssa-alias.c12
2 files changed, 17 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c444728..b04b38b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2019-05-31 Jan Hubicka <jh@suse.cz>
+
+ * tree-ssa-alias.c (type_has_components_p): New function.
+ (aliasing_component_refs_p): Use it.
+
2019-05-31 Martin Liska <mliska@suse.cz>
* gdbhooks.py: Add const_tree to TreePrinter.
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index 3ecb337..429288b 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -822,6 +822,16 @@ same_type_for_tbaa (tree type1, tree type2)
return 0;
}
+/* Return true if TYPE is a composite type (i.e. we may apply one of handled
+ components on it). */
+
+static bool
+type_has_components_p (tree type)
+{
+ return AGGREGATE_TYPE_P (type) || VECTOR_TYPE_P (type)
+ || TREE_CODE (type) == COMPLEX_TYPE;
+}
+
/* Determine if the two component references REF1 and REF2 which are
based on access types TYPE1 and TYPE2 and of which at least one is based
on an indirect reference may alias. REF2 is the only one that can
@@ -965,6 +975,7 @@ aliasing_component_refs_p (tree ref1,
if there is no B2 in the tail of path1 and no B1 on the
tail of path2. */
if (compare_type_sizes (TREE_TYPE (ref2), type1) >= 0
+ && type_has_components_p (TREE_TYPE (ref2))
&& (base1_alias_set == ref2_alias_set
|| alias_set_subset_of (base1_alias_set, ref2_alias_set)))
{
@@ -974,6 +985,7 @@ aliasing_component_refs_p (tree ref1,
/* If this is ptr vs. decl then we know there is no ptr ... decl path. */
if (!ref2_is_decl
&& compare_type_sizes (TREE_TYPE (ref1), type2) >= 0
+ && type_has_components_p (TREE_TYPE (ref1))
&& (base2_alias_set == ref1_alias_set
|| alias_set_subset_of (base2_alias_set, ref1_alias_set)))
{