Commit d1a7d8de by Jan Hubicka Committed by Jan Hubicka

tree-ssa-alias.c (aliasing_component_refs_p): Remove ref2_is_decl parameter; it…

tree-ssa-alias.c (aliasing_component_refs_p): Remove ref2_is_decl parameter; it has no use in gimple memory model.

	* tree-ssa-alias.c (aliasing_component_refs_p): Remove ref2_is_decl
	parameter; it has no use in gimple memory model.
	(indirect_ref_may_alias_decl_p): Update.

	* gcc.c-torture/execute/alias-access-path-1.c: New testcase.

From-SVN: r272510
parent 86f73527
2019-06-20 Jan Hubicka <jh@suse.cz>
* tree-ssa-alias.c (aliasing_component_refs_p): Remove ref2_is_decl
parameter; it has no use in gimple memory model.
(indirect_ref_may_alias_decl_p): Update.
2019-06-20 Martin Liska <mliska@suse.cz> 2019-06-20 Martin Liska <mliska@suse.cz>
* params.def (PARAM_HASH_TABLE_VERIFICATION_LIMIT): Decrease * params.def (PARAM_HASH_TABLE_VERIFICATION_LIMIT): Decrease
......
2019-06-20 Jan Hubicka <jh@suse.cz>
* gcc.c-torture/execute/alias-access-path-1.c: New testcase.
2019-06-20 Marek Polacek <polacek@redhat.com> 2019-06-20 Marek Polacek <polacek@redhat.com>
PR c++/89873 PR c++/89873
......
/* Test that variable
int val;
may hold value of tyope "struct c" which has same size.
This is valid in GIMPLE memory model. */
struct a {int val;} a={1},a2;
struct b {struct a a;};
int val;
struct c {struct b b;} *cptr=(void *)&val;
int
main(void)
{
cptr->b.a=a;
val = 2;
a2=cptr->b.a;
if (a2.val == a.val)
__builtin_abort ();
}
...@@ -850,8 +850,7 @@ type_has_components_p (tree type) ...@@ -850,8 +850,7 @@ type_has_components_p (tree type)
/* Determine if the two component references REF1 and REF2 which are /* 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 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 on an indirect reference may alias.
be a decl in which case REF2_IS_DECL is true.
REF1_ALIAS_SET, BASE1_ALIAS_SET, REF2_ALIAS_SET and BASE2_ALIAS_SET REF1_ALIAS_SET, BASE1_ALIAS_SET, REF2_ALIAS_SET and BASE2_ALIAS_SET
are the respective alias sets. */ are the respective alias sets. */
...@@ -863,8 +862,7 @@ aliasing_component_refs_p (tree ref1, ...@@ -863,8 +862,7 @@ aliasing_component_refs_p (tree ref1,
tree ref2, tree ref2,
alias_set_type ref2_alias_set, alias_set_type ref2_alias_set,
alias_set_type base2_alias_set, alias_set_type base2_alias_set,
poly_int64 offset2, poly_int64 max_size2, poly_int64 offset2, poly_int64 max_size2)
bool ref2_is_decl)
{ {
/* If one reference is a component references through pointers try to find a /* If one reference is a component references through pointers try to find a
common base and apply offset based disambiguation. This handles common base and apply offset based disambiguation. This handles
...@@ -982,7 +980,7 @@ aliasing_component_refs_p (tree ref1, ...@@ -982,7 +980,7 @@ aliasing_component_refs_p (tree ref1,
if (TREE_CODE (TREE_TYPE (base1)) == ARRAY_TYPE if (TREE_CODE (TREE_TYPE (base1)) == ARRAY_TYPE
&& (!TYPE_SIZE (TREE_TYPE (base1)) && (!TYPE_SIZE (TREE_TYPE (base1))
|| TREE_CODE (TYPE_SIZE (TREE_TYPE (base1))) != INTEGER_CST || TREE_CODE (TYPE_SIZE (TREE_TYPE (base1))) != INTEGER_CST
|| (ref == base2 && !ref2_is_decl))) || ref == base2))
{ {
++alias_stats.aliasing_component_refs_p_may_alias; ++alias_stats.aliasing_component_refs_p_may_alias;
return true; return true;
...@@ -1041,7 +1039,7 @@ aliasing_component_refs_p (tree ref1, ...@@ -1041,7 +1039,7 @@ aliasing_component_refs_p (tree ref1,
if (TREE_CODE (TREE_TYPE (base2)) == ARRAY_TYPE if (TREE_CODE (TREE_TYPE (base2)) == ARRAY_TYPE
&& (!TYPE_SIZE (TREE_TYPE (base2)) && (!TYPE_SIZE (TREE_TYPE (base2))
|| TREE_CODE (TYPE_SIZE (TREE_TYPE (base2))) != INTEGER_CST || TREE_CODE (TYPE_SIZE (TREE_TYPE (base2))) != INTEGER_CST
|| (ref == base1 && !ref2_is_decl))) || ref == base1))
{ {
++alias_stats.aliasing_component_refs_p_may_alias; ++alias_stats.aliasing_component_refs_p_may_alias;
return true; return true;
...@@ -1089,8 +1087,7 @@ aliasing_component_refs_p (tree ref1, ...@@ -1089,8 +1087,7 @@ aliasing_component_refs_p (tree ref1,
return true; return true;
} }
/* If this is ptr vs. decl then we know there is no ptr ... decl path. */ /* If this is ptr vs. decl then we know there is no ptr ... decl path. */
if (!ref2_is_decl if (compare_type_sizes (TREE_TYPE (ref1), type2) >= 0
&& compare_type_sizes (TREE_TYPE (ref1), type2) >= 0
&& (!end_struct_ref2 && (!end_struct_ref2
|| compare_type_sizes (TREE_TYPE (ref1), || compare_type_sizes (TREE_TYPE (ref1),
TREE_TYPE (end_struct_ref2)) >= 0) TREE_TYPE (end_struct_ref2)) >= 0)
...@@ -1554,13 +1551,7 @@ indirect_ref_may_alias_decl_p (tree ref1 ATTRIBUTE_UNUSED, tree base1, ...@@ -1554,13 +1551,7 @@ indirect_ref_may_alias_decl_p (tree ref1 ATTRIBUTE_UNUSED, tree base1,
offset1, max_size1, offset1, max_size1,
ref2, ref2,
ref2_alias_set, base2_alias_set, ref2_alias_set, base2_alias_set,
offset2, max_size2, offset2, max_size2);
/* Only if the other reference is actual
decl we can safely check only toplevel
part of access path 1. */
same_type_for_tbaa (TREE_TYPE (dbase2),
TREE_TYPE (base2))
== 1);
return true; return true;
} }
...@@ -1675,7 +1666,7 @@ indirect_refs_may_alias_p (tree ref1 ATTRIBUTE_UNUSED, tree base1, ...@@ -1675,7 +1666,7 @@ indirect_refs_may_alias_p (tree ref1 ATTRIBUTE_UNUSED, tree base1,
offset1, max_size1, offset1, max_size1,
ref2, ref2,
ref2_alias_set, base2_alias_set, ref2_alias_set, base2_alias_set,
offset2, max_size2, false); offset2, max_size2);
return true; return true;
} }
......
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