public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Guenther <rguenther@suse.de>
To: Jan Hubicka <hubicka@ucw.cz>
Cc: 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:30:00 -0000	[thread overview]
Message-ID: <alpine.LNX.2.00.1104191259040.810@zhemvz.fhfr.qr> (raw)
In-Reply-To: <20110419104801.GJ911@atrey.karlin.mff.cuni.cz>

On Tue, 19 Apr 2011, Jan Hubicka wrote:

> > 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 ;)

I thought the idea was to use __builtin_va_arg_pack and friends.
Of course the inliner would still need to know how to inline such
a va-arg forwarder, and we would need a way to expand them (well,
or just go the existing special casing).  We might need this
kind of inliner support anyway because of the partial inlining
opportunity in libquantum which is for a varargs function like

void foo (...)
{
  if (always-zero-static)
    return;

  ...
}

thus partial inlining would create such a forwarding call.

But well, it's just my random 2 cents on the issue ;)

Richard.

  reply	other threads:[~2011-04-19 11:02 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
2011-04-19 11:30             ` Richard Guenther [this message]
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=alpine.LNX.2.00.1104191259040.810@zhemvz.fhfr.qr \
    --to=rguenther@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=jakub@redhat.com \
    --cc=jason@redhat.com \
    --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).