public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@ucw.cz>
To: Richard Guenther <rguenther@suse.de>
Cc: Jan Hubicka <hubicka@ucw.cz>,
	Richard Guenther <richard.guenther@gmail.com>,
	Jakub Jelinek <jakub@redhat.com>,
	Jason Merrill <jason@redhat.com>,	Martin Jambor <mjambor@suse.cz>,
	gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Fix incorrect devirtualization (PR middle-end/48661)
Date: Tue, 19 Apr 2011 11:12:00 -0000	[thread overview]
Message-ID: <20110419104801.GJ911@atrey.karlin.mff.cuni.cz> (raw)
In-Reply-To: <alpine.LNX.2.00.1104191221310.810@zhemvz.fhfr.qr>

> On Tue, 19 Apr 2011, Jan Hubicka wrote:
> 
> > > Huh.  No, I don't think we want to do any "inlining" as part of
> > > folding.  At least not if it
> > > is a correctness issue (is it?).  Why does the inliner not simply
> > > inline the thunk function
> > > body?
> > 
> > Because thunk functions have no bodies in gimple form and are no functions (at
> > the moment) in cgraph sense.
> 
> Well, I see thunks as simple forwarders which we can represent with
> a real function with body in gimple.  We don't have to _emit_ it

That is true only for non-variadic thunks. (and we actually generate bodies for
those early, unless target asked us to do otherwise).  Sure, Diego once
mentioned that we might have some kind of special thunk_call gimple statement,
but that seems to me that amount of gimple code that would need to handle
thunk_call strictly exceeds amount of IPA code that would need to get past
special kind of functions.

Also as as we make them regular functions, we need to go all the way through,
as IPA optimizers will happily modify them so simply using existing target
interface instead of cfgexpand later won't help.  In a way, with tailcall
support, the target interface is really only interesting for variadic case.
At least for i386. I did not inspect details of implementation of thunks on
all the archs that do asm thunks to be sure.

> that way later, but at least IPA passes could do regular stmt
> analysis on them and not need any special thunk knowledge (maybe
> apart from making the inliner not inline the forwarding call into
> the thunk itself).
> 
> > What IPA infrastructure needs to learn is to handle inlining of those as well
> > as compute proper jump functions.  We spoke with Martin on this some time ago,
> > we ought to get this done in 4.7. Thunks are very irritating spcial cases from
> > cgraph POV ;(
> 
> And I don't see why they have to be very irritating spcial cases ;)

Well, becuase of variadic thunks, I think ;)

Honza
> 
> > I however like the idea that code doing devirtualizatio (type based or folding based)
> > will also do adjustment to call the actual functions instead of thunk.  Direct
> > calls to thunks are quite nonsential.
> 
> Well, sure.  If we discover a direct call to a thunk late, after inlining
> we can do some tricks to inline the adjustment, even during folding.  Just
> analysis passes should simply see the thunk.
> 
> Richard.

  reply	other threads:[~2011-04-19 10:48 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-18 22:33 Jakub Jelinek
2011-04-18 23:35 ` Richard Guenther
2011-04-18 23:43 ` Jason Merrill
2011-04-19  7:46   ` Jakub Jelinek
2011-04-19 23:37     ` Jason Merrill
2011-04-20 14:32     ` Martin Jambor
2011-04-19  0:07 ` H.J. Lu
2011-04-19  0:21 ` Jan Hubicka
2011-04-19  0:24   ` Jan Hubicka
2011-04-19  8:58     ` Richard Guenther
2011-04-19 10:27       ` Jan Hubicka
2011-04-19 10:51         ` Richard Guenther
2011-04-19 11:12           ` Jan Hubicka [this message]
2011-04-19 11:30             ` Richard Guenther
2011-04-19 14:59               ` Jan Hubicka
2011-04-19 14:59                 ` Richard Guenther
2011-04-19 15:00                   ` Jan Hubicka
2011-04-20 14:50     ` Martin Jambor
2011-04-20 15:06       ` Jan Hubicka
2011-04-20 15:25         ` Richard Guenther
2011-04-20 15:35           ` Jan Hubicka
2011-04-20 15:28         ` Martin Jambor

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=20110419104801.GJ911@atrey.karlin.mff.cuni.cz \
    --to=hubicka@ucw.cz \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=jason@redhat.com \
    --cc=mjambor@suse.cz \
    --cc=rguenther@suse.de \
    --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).