diff options
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -14101,6 +14101,7 @@ gimple_canonical_types_compatible_p (const_tree t1, const_tree t2, gcc_assert (!trust_type_canonical || (type_with_alias_set_p (t1) && type_with_alias_set_p (t2))); + /* If the types have been previously registered and found equal they still are. */ @@ -14118,6 +14119,14 @@ gimple_canonical_types_compatible_p (const_tree t1, const_tree t2, return TYPE_CANONICAL (t1) == TYPE_CANONICAL (t2); } + /* For types where we do ODR based TBAA the canonical type is always + set correctly, so we know that types are different if their + canonical types does not match. */ + if (trust_type_canonical + && (odr_type_p (t1) && odr_based_tbaa_p (t1)) + != (odr_type_p (t2) && odr_based_tbaa_p (t2))) + return false; + /* Can't be the same type if the types don't have the same code. */ enum tree_code code = tree_code_for_canonical_type_merging (TREE_CODE (t1)); if (code != tree_code_for_canonical_type_merging (TREE_CODE (t2))) |