From bedcf4da9f352674390304bed1e71b79c5c28cc5 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Tue, 4 Jun 2019 13:30:32 +0200 Subject: [PATCH] Strengthen alias_ptr_types_compatible_p in LTO mode. gcc/ChangeLog: 2019-07-24 Martin Liska * alias.c (alias_ptr_types_compatible_p): Strengten type comparison in LTO mode. --- gcc/alias.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gcc/alias.c b/gcc/alias.c index 2755df72907..1579dfa68a7 100644 --- a/gcc/alias.c +++ b/gcc/alias.c @@ -793,8 +793,16 @@ alias_ptr_types_compatible_p (tree t1, tree t2) || ref_all_alias_ptr_type_p (t2)) return false; - return (TYPE_MAIN_VARIANT (TREE_TYPE (t1)) - == TYPE_MAIN_VARIANT (TREE_TYPE (t2))); + /* This function originally abstracts from simply comparing + get_deref_alias_set so that we are sure this still computes + the same result after LTO type merging is applied. + When in LTO type merging is done we can actually do this compare. + */ + if (in_lto_p) + return get_deref_alias_set (t1) == get_deref_alias_set (t2); + else + return (TYPE_MAIN_VARIANT (TREE_TYPE (t1)) + == TYPE_MAIN_VARIANT (TREE_TYPE (t2))); } /* Create emptry alias set entry. */ -- 2.22.0