https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90303

--- Comment #3 from Jan Hubicka <hubicka at ucw dot cz> ---
> This comes from build_type_attribute_qual_variant:
> 1159          if (ntype != dtype)
> 1160            /* This variant was already in the hash table, don't mess with
> 1161               TYPE_CANONICAL.  */;
> 1162          else if (TYPE_STRUCTURAL_EQUALITY_P (ttype)
> 1163                   || !comp_type_attributes (ntype, ttype))
> 1164            /* If the target-dependent attributes make NTYPE different 
> from
> 1165               its canonical type, we will need to use structural equality
> 1166               checks for this type.
> 1167    
> 1168               We shouldn't get here for stripping attributes from a type;
> 1169               the no-attribute type might not need structural 
> comparison. 
> But
> 1170               we can if was discarded from type_hash_table.  */
> 1171            SET_TYPE_STRUCTURAL_EQUALITY (ntype);

Hmm, bit odd code.
> 
> --- gcc/ipa-devirt.c.jj 2019-04-15 19:45:28.796340266 +0200
> +++ gcc/ipa-devirt.c    2019-05-02 10:46:03.077896176 +0200
> @@ -2020,7 +2020,7 @@ obj_type_ref_class (const_tree ref)
>    ref = TREE_VALUE (TYPE_ARG_TYPES (ref));
>    gcc_checking_assert (TREE_CODE (ref) == POINTER_TYPE);
>    tree ret = TREE_TYPE (ref);
> -  if (!in_lto_p)
> +  if (!in_lto_p && !TYPE_STRUCTURAL_EQUALITY_P (ret))

This code is here to go from incomplete type to complete type after
free_lang_data was run.  By punting here we will lose optimization.
Perhaps it is safe to go to main variant first and then to type
canonical since the main variant will not have type_canonical cleared by
hunk above?

Honza
>      ret = TYPE_CANONICAL (ret);
>    else
>      ret = get_odr_type (ret)->type;
> @@ -2042,7 +2042,7 @@ get_odr_type (tree type, bool insert)
>    int base_id = -1;
> 
>    type = TYPE_MAIN_VARIANT (type);
> -  if (!in_lto_p)
> +  if (!in_lto_p && !TYPE_STRUCTURAL_EQUALITY_P (type))
>      type = TYPE_CANONICAL (type);
> 
>    gcc_checking_assert (can_be_name_hashed_p (type)
> 
> -- 
> You are receiving this mail because:
> You are on the CC list for the bug.

Reply via email to