]> git.ipfire.org Git - thirdparty/gcc.git/commit - gcc/ipa-devirt.c
Make ltrans type canonicals compatible with WPA ones
authorJan Hubicka <jh@suse.cz>
Tue, 17 Nov 2020 14:38:13 +0000 (15:38 +0100)
committerJan Hubicka <jh@suse.cz>
Tue, 17 Nov 2020 14:38:13 +0000 (15:38 +0100)
commit18dd295638724b455e072cd790451ace15a3d463
treea90291ffbe7e8484221855d44018859a24644880
parent8a97aed0d290bc12b91091703444546d9b3edba7
Make ltrans type canonicals compatible with WPA ones

This patch fixes profiledbootstrap failure with LTO enabled.
Not refining alias sets from WPA to ltrans time is a good invariant to
maintain and the canonical type hash behaves this way.  However I broke
this with the ODR logic.

Normally we define canonical types for C++ ODR types according to their
type names.  However to make ODR types compatible with C types we check
if structurally equivalent C type exists and if so, we ignore ODR
names giving up on the precision.

This however is not stable between WPA and ltrans since at ltrans the
type merging does not see as many types as WPA does.  To make this
consistent the patch makes WPA ODR_TYPE_P == 0 for ODR types that
conflicted with non-ODR type.

I had to drop one sanity check in ipa-utils.h (that I think is not very
important - I added it while introducing CXX_ODR_P machinery) and also
it now may happen that we query odr_based_tbaa_p before registering
first ODR type so we do not want to ICE here.
ODR type registration happens early to produce ODR violation warings.
Those are not done at ltrans, so dropping the registration is safe. The
type will still be added while computing the type inheritance graph if
needed for devirtualization (and late devirtualization is not very
useful anyway since it won't enable inlining).

gcc/ChangeLog:
PR bootstrap/97857
* ipa-devirt.c (odr_based_tbaa_p): Do not ICE when
odr_hash is not initialized
* ipa-utils.h (type_with_linkage_p): Do not sanity check
CXX_ODR_P.
* tree-streamer-out.c (pack_ts_type_common_value_fields): Set
CXX_ODR_P according to the canonical type.

gcc/lto/ChangeLog:
PR bootstrap/97857
* lto-common.c (gimple_register_canonical_type_1): Only
register types with TYPE_CXX_ODR_P flag; sanity check that no
conflict happens at ltrans time.
gcc/ipa-devirt.c
gcc/ipa-utils.h
gcc/lto/lto-common.c
gcc/tree-streamer-out.c