From: Jan Hubicka <hubicka@ucw.cz>
To: Richard Biener <richard.guenther@gmail.com>
Cc: Martin Jambor <mjambor@suse.cz>, GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] ipa-sra: Consider the first parameter of methods safe to dereference
Date: Thu, 15 Dec 2022 18:52:47 +0100 [thread overview]
Message-ID: <Y5te7/lPdpiwm32z@kam.mff.cuni.cz> (raw)
In-Reply-To: <CAFiYyc15Lf7n2vJc2OB7he5G4u1QwZH67Mm04FmfhcHUY2ueWQ@mail.gmail.com>
> On Wed, Dec 14, 2022 at 4:20 PM Jan Hubicka via Gcc-patches
> <gcc-patches@gcc.gnu.org> wrote:
> >
> > > Hi,
> > >
> > > Honza requested this after reviewing the patch that taught IPA-SRA
> > > that REFERENCE_TYPEs are always non-NULL that the pass also handles
> > > the first parameters of methods, this pointers, in the same way. So
> > > this patch does that.
> > >
> > > The patch is undergoing bootstrap and testing on an x86_64-linux right
> > > now. OK if it passes?
> > >
> > > Thanks,
> > >
> > > Martin
> > >
> > >
> > > gcc/ChangeLog:
> > >
> > > 2022-12-14 Martin Jambor <mjambor@suse.cz>
> > >
> > > * ipa-sra.cc (create_parameter_descriptors): Consider the first
> > > parameter of a method safe to dereference.
> > >
> > > gcc/testsuite/ChangeLog:
> > >
> > > 2022-12-14 Martin Jambor <mjambor@suse.cz>
> > >
> > > * g++.dg/ipa/ipa-sra-6.C: New test.
> >
> > OK,
>
> Are you sure that's safe? The docs for METHOD_TYPE doesn't say 'this'
> is the first parameter nor does it say methods cannot be invoked for a
> nullptr object.
>
> Do frontends other than C++ create METHOD_TYPE functions? Grep
> shows uses in ada and objective C at least.
I think for Objective-C++ calling method is also considerd a
dereference. We make similar assumptions in devirtualization code for
some time. We could also check that the type is METHOD_TYPE satisfies
odr_type_p if we want to look specifically for C++ methods.
Honza
>
> > thanks a lot!
> > Honza
prev parent reply other threads:[~2022-12-15 17:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-14 15:18 Martin Jambor
2022-12-14 15:20 ` Jan Hubicka
2022-12-15 8:20 ` Richard Biener
2022-12-15 17:52 ` Jan Hubicka [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y5te7/lPdpiwm32z@kam.mff.cuni.cz \
--to=hubicka@ucw.cz \
--cc=gcc-patches@gcc.gnu.org \
--cc=mjambor@suse.cz \
--cc=richard.guenther@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).