middle-end/94539 - void * aliases every other pointer

This makes same_type_for_tbaa_p conservative in the same way
get_alias_set is about void * which we allow to alias all other
pointers.

2020-04-15  Richard Biener  <rguenther@suse.de>

	PR middle-end/94539
	* tree-ssa-alias.c (same_type_for_tbaa): Defer to
	alias_sets_conflict_p for pointers.

	* gcc.dg/alias-14.c: Make dg-do run.
This commit is contained in:
Richard Biener 2020-04-14 13:16:25 +02:00
parent 5b6551bc60
commit e71b408aa2
4 changed files with 22 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2020-04-15 Richard Biener <rguenther@suse.de>
PR middle-end/94539
* tree-ssa-alias.c (same_type_for_tbaa): Defer to
alias_sets_conflict_p for pointers.
2020-04-14 Max Filippov <jcmvbkbc@gmail.com>
PR target/94584

View File

@ -1,3 +1,8 @@
2020-04-15 Richard Biener <rguenther@suse.de>
PR middle-end/94539
* gcc.dg/alias-14.c: Make dg-do run.
2020-04-13 Max Filippov <jcmvbkbc@gmail.com>
PR target/94584

View File

@ -1,4 +1,4 @@
/* { dg-do compile } */
/* { dg-do run } */
/* { dg-options "-O2" } */
#include <stddef.h>
void *a;

View File

@ -839,7 +839,16 @@ same_type_for_tbaa (tree type1, tree type2)
would mean that conversions between them are useless, whereas they are
not (e.g. type and subtypes can have different modes). So, in the end,
they are only guaranteed to have the same alias set. */
if (get_alias_set (type1) == get_alias_set (type2))
alias_set_type set1 = get_alias_set (type1);
alias_set_type set2 = get_alias_set (type2);
if (set1 == set2)
return -1;
/* Pointers to void are considered compatible with all other pointers,
so for two pointers see what the alias set resolution thinks. */
if (POINTER_TYPE_P (type1)
&& POINTER_TYPE_P (type2)
&& alias_sets_conflict_p (set1, set2))
return -1;
/* The types are known to be not equal. */