This is the mail archive of the
mailing list for the GCC project.
Re: [EXT] Re: Comparing types at LTO time
- From: Gary Oblock <goblock at marvell dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: Jan Hubicka <hubicka at ucw dot cz>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Fri, 10 Jan 2020 23:47:36 +0000
- Subject: Re: [EXT] Re: Comparing types at LTO time
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5lavF5ct8uw+1IHT2kylzPk8FooxtVH7n3wSBEe881E=; b=jE8Fxyl75ZW48lSrUvVQuWh2JjeGiI2FTlveTtx6vHIED8s4sMoY63iwqZyNF4auFcbm/mGn5CVTnorjk0jJAAGjX7d2R3t5l5EuqNDloUfe8xLQJD2vLgGZj0TnMGo2KpQ5QlwCQ/8oOjHaz8P/xcs7xLYZPXWfhFw+2AD/JN7hMsm/04J181vsxpe7ffdD1Gu0HoR6Ef9tCWbyIJLsP13YL320YYO1cAab03PAtv6ihkP6Y6aBlqcsMLcVf7wqtQhDul3KVnlBpRsI416IxLdQ/QuaWq7A8GBj2RjNPkEh+hRrD5H7X13XjFUapPN3IkMzve7ZUpHXtM8Eve10aw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M9MlZuz62JaY8iiABwTI+BJgVNelb4i8xLDO+eFVs2KbBciajDW2WOH8J9baHGD9fJiNgOmt4+c3rgmRZLV32V5gz3jwmV8YBKlkvmLWAUBsFz1+PrfohzjJrhoWintTlP8HP/8pdzn8Ui2C4lDXZOF5nfyMEJsS2EoiQ3WnjMi7aLoN5XYjRpQT3htmJSvIIk5TVSL+aKR5WfXXZsjOQiVcbhyUcN0vmV2CyTAN0hyl0lZqU4fVzvcJJx60LH8vjlK9SQSDgY3RRiD9vdqlaosauG3eQ7DyTJ105UZuVT3KpD0HqpkdtCIu8qw+bCrZwdCrAN0tko+kdP4LBAf5aA==
- References: <BY5PR18MB3409528680E154A19FB29C17B9390@BY5PR18MB3409.namprd18.prod.outlook.com> <20200109085318.GK4674@kam.mff.cuni.cz> <CAFiYyc1FZJyU1xySuzy7vv+7+o-cx_OJTW2dntjWHjQhkyz6Rw@mail.gmail.com> <BY5PR18MB3409BE0C6394B56D4E96B974B9390@BY5PR18MB3409.namprd18.prod.outlook.com>,<CAFiYyc1E7PDUcrh3d4ahwoLG7ZxnYf1iEVD9YO6atj1_CaYCFQ@mail.gmail.com>
Let me see if I've got this straight. Are you saying it's the
shape of objects combined with the variables that point at these
objects (or some subpart of them) that should drive struct reorg?
It seems to be hard to understand how to proceed from that notion
without something like types to fall back on.
If the struct reorg lumps all the types with the same shape together
into sets, aren't each of those sets type like and couldn't the sets be used
to drive the optimization?
From: Richard Biener <email@example.com>
Sent: Friday, January 10, 2020 2:29 AM
To: Gary Oblock <firstname.lastname@example.org>
Cc: Jan Hubicka <email@example.com>; firstname.lastname@example.org <email@example.com>
Subject: Re: [EXT] Re: Comparing types at LTO time
On Thu, Jan 9, 2020 at 9:36 PM Gary Oblock <firstname.lastname@example.org> wrote:
> Alas, when doing structure reorg I have to be able to know some
> arbitrary use of variable X in some GIMPLE expression is of a
> type that needs to be transformed in that given expression. I see no
> way around this.
Sure, if you view it as it transforming a type. I see it as transforming
the layout of a specific object so all you need to know is whether an
arbitrary memory access accesses the very object - which you could,
if you face accesses you can't analyze, even check at runtime to some
extent (worst case by providing a copy in/out to a temporary with the
> From: Richard Biener <email@example.com>
> Sent: Thursday, January 9, 2020 3:51 AM
> To: Jan Hubicka <firstname.lastname@example.org>
> Cc: Gary Oblock <email@example.com>; firstname.lastname@example.org <email@example.com>
> Subject: [EXT] Re: Comparing types at LTO time
> External Email
> On Thu, Jan 9, 2020 at 9:53 AM Jan Hubicka <firstname.lastname@example.org> wrote:
> > > There doesn't seem to be a way to compare types at LTO time. The functions
> > > same_type_p and comptypes are front end only if I'm not totally confused
> > > (which is quite possible) and type_hash_eq doesn't seem to apply for
> > > structure types. Please, any advice would be welcome.
> > At LTO time it is bit hard to say what really is the "same type". We
> > have multiple notions of equivalence:
> > 1) TYPE_MAIN_VARIANT (t1) == TYPE_MAIN_VARIANT (t2)
> > means that both types were equal in tree merging at stream in, this
> > means that their IL representaiton is identical.
> > This will lead to "false" for types that are same bud did not get
> > merged for various reasons. One such valid reason, for example, is
> > visibility of associated virtual tables
> > 2) types_types_same_for_odr returns true if types are considered same
> > by C++ one definition rule. This is reliable but works only for C++
> > types with names (structures and unions)
> > 3) same_type_for_tbaa returns true if types are equivalent for type
> > based alias analysis. It returns true in much more cases than 1
> > but is too coarse if you want to do datastructure changes.
> > So in general this is quite hard problem (and in fact I started to play
> > with ODR types originally to understand it better). I would suggest
> > starting with 1 if you want to rewrite types and eventually add a new
> > comparsion once pass does something useful.
> > Richard may have some extra insights.
> My advice would be to not go down the route that requires comparing types
> since I'm not sure you can do that conservatively since you at the same
> time may not say two types are equal when they are not nor miss two
> equal types. For example if you have a C TU and a Fortran TU there's
> defined interoperability but the actual type representations are distinct
> enough so that Honzas equality according to 1) doesn't trigger (nor does 2),
> but 3) does, but that will identify too many types as equal.
> > Honza
> > >
> > > Thanks,
> > >
> > > Gary Oblock
> > >