tree-ssa-alias.c (same_type_for_tbaa): Return -1 if the types have the same alias set and their sizes different...

* tree-ssa-alias.c (same_type_for_tbaa): Return -1 if the types have
	the same alias set and their sizes different constantness.
	(aliasing_component_refs_p): Revert 2009-10-24 change.

From-SVN: r156362
This commit is contained in:
Eric Botcazou 2010-01-29 18:21:39 +00:00 committed by Eric Botcazou
parent dd70c86077
commit 55eb4dab27
2 changed files with 19 additions and 14 deletions

View file

@ -1,3 +1,9 @@
2010-01-29 Eric Botcazou <ebotcazou@adacore.com>
* tree-ssa-alias.c (same_type_for_tbaa): Return -1 if the types have
the same alias set and their sizes different constantness.
(aliasing_component_refs_p): Revert 2009-10-24 change.
2010-01-29 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* config/sparc/sparc.c (sparc_elf_asm_named_section): Declare decl

View file

@ -537,13 +537,22 @@ same_type_for_tbaa (tree type1, tree type2)
if (TYPE_CANONICAL (type1) == TYPE_CANONICAL (type2))
return 1;
/* ??? Array types are not properly unified in all cases as we have
/* ??? Array types are not properly unified in all cases as we have
spurious changes in the index types for example. Removing this
causes all sorts of problems with the Fortran frontend. */
if (TREE_CODE (type1) == ARRAY_TYPE
&& TREE_CODE (type2) == ARRAY_TYPE)
return -1;
/* In Ada, an lvalue of unconstrained type can be used to access an object
of one of its constrained subtypes, for example when a function with an
unconstrained parameter passed by reference is called on a constrained
object and inlined. In this case, the types have the same alias set. */
if (TYPE_SIZE (type1) && TYPE_SIZE (type2)
&& TREE_CONSTANT (TYPE_SIZE (type1)) != TREE_CONSTANT (TYPE_SIZE (type2))
&& get_alias_set (type1) == get_alias_set (type2))
return -1;
/* The types are known to be not equal. */
return 0;
}
@ -600,19 +609,9 @@ aliasing_component_refs_p (tree ref1, tree type1,
offset1 -= offadj;
return ranges_overlap_p (offset1, max_size1, offset2, max_size2);
}
/* We haven't found any common base to apply offset-based disambiguation.
There are two cases:
1. The base access types have the same alias set. This can happen
in Ada when a function with an unconstrained parameter passed by
reference is called on a constrained object and inlined: the types
have the same alias set but aren't equivalent. The references may
alias in this case.
2. The base access types don't have the same alias set, i.e. one set
is a subset of the other. We have proved that B1 is not in the
access path B2.path and that B2 is not in the access path B1.path
so the references may not alias. */
return get_alias_set (type1) == get_alias_set (type2);
/* If we have two type access paths B1.path1 and B2.path2 they may
only alias if either B1 is in B2.path2 or B2 is in B1.path1. */
return false;
}
/* Return true if two memory references based on the variables BASE1