aboutsummaryrefslogtreecommitdiff
path: root/gcc/alias.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2019-06-01 18:36:49 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2019-06-01 16:36:49 +0000
commite4b44fd741ee25aa5ad086949ccfbcbd3736c0f3 (patch)
treede277309e24560ad8eaec387435ea436ae9943ba /gcc/alias.c
parent5a2a2fb3152a801b5652bb65c380d92db2d900d3 (diff)
downloadgcc-e4b44fd741ee25aa5ad086949ccfbcbd3736c0f3.zip
gcc-e4b44fd741ee25aa5ad086949ccfbcbd3736c0f3.tar.gz
gcc-e4b44fd741ee25aa5ad086949ccfbcbd3736c0f3.tar.bz2
alias.c: Include ipa-utils.h.
* alias.c: Include ipa-utils.h. (get_alias_set): Try to complete ODR type via ODR type hash lookup. * ipa-devirt.c (prevailing_odr_type): New. * ipa-utils.h (previaling_odr_type): Declare. * g++.dg/lto/alias-1_0.C: New testcase. * g++.dg/lto/alias-1_1.C: New testcase. From-SVN: r271837
Diffstat (limited to 'gcc/alias.c')
-rw-r--r--gcc/alias.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/alias.c b/gcc/alias.c
index d3cc07c..eece84a 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -39,6 +39,7 @@ along with GCC; see the file COPYING3. If not see
#include "cfganal.h"
#include "rtl-iter.h"
#include "cgraph.h"
+#include "ipa-utils.h"
/* The aliasing API provided here solves related but different problems:
@@ -1008,6 +1009,14 @@ get_alias_set (tree t)
}
p = TYPE_MAIN_VARIANT (p);
+ /* In LTO for C++ programs we can turn in complete types to complete
+ using ODR name lookup. */
+ if (in_lto_p && TYPE_STRUCTURAL_EQUALITY_P (p) && odr_type_p (p))
+ {
+ p = prevailing_odr_type (p);
+ gcc_checking_assert (TYPE_MAIN_VARIANT (p) == p);
+ }
+
/* Make void * compatible with char * and also void **.
Programs are commonly violating TBAA by this.