diff options
author | Jan Hubicka <jh@suse.cz> | 2024-05-15 14:14:27 +0200 |
---|---|---|
committer | Jan Hubicka <jh@suse.cz> | 2024-05-15 14:14:27 +0200 |
commit | 9b7cad5884f21cc5783075be0043777448db3fab (patch) | |
tree | 75605b4c2d45a6bda66b7386ce48a56327597c37 /gcc/alias.cc | |
parent | ff105c39bde43bdb57615e3a4c7af71fbef5f26e (diff) | |
download | gcc-9b7cad5884f21cc5783075be0043777448db3fab.zip gcc-9b7cad5884f21cc5783075be0043777448db3fab.tar.gz gcc-9b7cad5884f21cc5783075be0043777448db3fab.tar.bz2 |
Avoid pointer compares on TYPE_MAIN_VARIANT in TBAA
while building more testcases for ipa-icf I noticed that there are two places
in aliasing code where we still compare TYPE_MAIN_VARIANT for pointer equality.
This is not good idea for LTO since type merging may not happen for example
when in one unit pointed to type is forward declared while in other it is fully
defined. We have same_type_for_tbaa for that.
Bootstrapped/regtested x86_64-linux, OK?
gcc/ChangeLog:
* alias.cc (reference_alias_ptr_type_1): Use view_converted_memref_p.
* alias.h (view_converted_memref_p): Declare.
* tree-ssa-alias.cc (view_converted_memref_p): Export.
(ao_compare::compare_ao_refs): Use same_type_for_tbaa.
Diffstat (limited to 'gcc/alias.cc')
-rw-r--r-- | gcc/alias.cc | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/gcc/alias.cc b/gcc/alias.cc index 808e209..853e84d 100644 --- a/gcc/alias.cc +++ b/gcc/alias.cc @@ -770,10 +770,7 @@ reference_alias_ptr_type_1 (tree *t) /* If the innermost reference is a MEM_REF that has a conversion embedded treat it like a VIEW_CONVERT_EXPR above, using the memory access type for determining the alias-set. */ - if (TREE_CODE (inner) == MEM_REF - && (TYPE_MAIN_VARIANT (TREE_TYPE (inner)) - != TYPE_MAIN_VARIANT - (TREE_TYPE (TREE_TYPE (TREE_OPERAND (inner, 1)))))) + if (view_converted_memref_p (inner)) { tree alias_ptrtype = TREE_TYPE (TREE_OPERAND (inner, 1)); /* Unless we have the (aggregate) effective type of the access |