aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vectorizer.h
diff options
context:
space:
mode:
authorMartin Uecker <uecker@tugraz.at>2023-08-15 22:38:14 +0200
committerMartin Uecker <uecker@tugraz.at>2023-12-21 08:43:16 +0100
commit140aa2cdf93c7729e362b09534535395357183f0 (patch)
treed64e26001033f9e6079a5720a8da4746090e4a5e /gcc/tree-vectorizer.h
parentced651b7757e6ef7e7e309f022cd71b4b6ead295 (diff)
downloadgcc-140aa2cdf93c7729e362b09534535395357183f0.zip
gcc-140aa2cdf93c7729e362b09534535395357183f0.tar.gz
gcc-140aa2cdf93c7729e362b09534535395357183f0.tar.bz2
c23: aliasing of compatible tagged types
Tell the backend which types are equivalent by setting TYPE_CANONICAL to one struct in the set of equivalent structs. Structs are considered equivalent by ignoring all sizes of arrays nested in types below field level. The following two structs are incompatible and lvalues with these types can be assumed not to alias: struct foo { int a[3]; }; struct foo { int a[4]; }; The following two structs are also incompatible, but will get the same TYPE_CANONICAL and it is then not exploited that lvalues with those types can not alias: struct bar { int (*p)[3]; }; struct bar { int (*p)[4]; }; The reason is that both are compatible to struct bar { int (*p)[]; }; and therefore are in the same equivalence class. For the same reason all enums with the same underyling type are in the same equivalence class. Tests are added for the expected aliasing behavior with optimization. gcc/c: * c-decl.cc (c_struct_hasher): Hash stable for struct types. (c_struct_hasher::hash, c_struct_hasher::equal): New functions. (finish_struct): Set TYPE_CANONICAL to first struct in equivalence class. * c-objc-common.cc (c_get_alias_set): Let structs or unions with variable size alias anything. * c-tree.h (comptypes_equiv): New prototype. * c-typeck.cc (comptypes_equiv): New function. (comptypes_internal): Implement equivalence mode. (tagged_types_tu_compatible): Implement equivalence mode. gcc/testsuite: * gcc.dg/c23-tag-2.c: Activate. * gcc.dg/c23-tag-5.c: Activate. * gcc.dg/c23-tag-alias-1.c: New test. * gcc.dg/c23-tag-alias-2.c: New test. * gcc.dg/c23-tag-alias-3.c: New test. * gcc.dg/c23-tag-alias-4.c: New test. * gcc.dg/c23-tag-alias-5.c: New test. * gcc.dg/gnu23-tag-alias-1.c: New test. * gcc.dg/gnu23-tag-alias-2.c: New test. * gcc.dg/gnu23-tag-alias-3.c: New test. * gcc.dg/gnu23-tag-alias-4.c: New test. * gcc.dg/gnu23-tag-alias-5.c: New test. * gcc.dg/gnu23-tag-alias-6.c: New test. * gcc.dg/gnu23-tag-alias-7.c: New test.
Diffstat (limited to 'gcc/tree-vectorizer.h')
0 files changed, 0 insertions, 0 deletions