middle-end/115110 - Fix view_converted_memref_p

view_converted_memref_p was checking the reference type against the
pointer type of the offset operand rather than its pointed-to type
which leads to all refs being subject to view-convert treatment
in get_alias_set causing numerous testsuite fails but with its
new uses from r15-512-g9b7cad5884f21c is also a wrong-code issue.

	PR middle-end/115110
	* tree-ssa-alias.cc (view_converted_memref_p): Fix.
This commit is contained in:
Richard Biener 2024-05-17 11:02:29 +02:00
parent 6a0a46c579
commit a5b3721c06

View file

@ -2077,8 +2077,9 @@ view_converted_memref_p (tree base)
{
if (TREE_CODE (base) != MEM_REF && TREE_CODE (base) != TARGET_MEM_REF)
return false;
return same_type_for_tbaa (TREE_TYPE (base),
TREE_TYPE (TREE_OPERAND (base, 1))) != 1;
return (same_type_for_tbaa (TREE_TYPE (base),
TREE_TYPE (TREE_TYPE (TREE_OPERAND (base, 1))))
!= 1);
}
/* Return true if an indirect reference based on *PTR1 constrained