public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@ucw.cz>
To: Jakub Jelinek <jakub@redhat.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: PR84229 part 1: Avoid cloning of functions that calls va_arg_pack
Date: Wed, 21 Feb 2018 20:12:00 -0000	[thread overview]
Message-ID: <20180221201224.GA49864@kam.mff.cuni.cz> (raw)
In-Reply-To: <20180221191308.GR5867@tucnak>

> On Wed, Feb 21, 2018 at 08:09:28PM +0100, Jan Hubicka wrote:
> > --- ipa-cp.c	(revision 257844)
> > +++ ipa-cp.c	(working copy)
> > @@ -630,6 +630,24 @@ determine_versionability (struct cgraph_
> >        reason = "calls comdat-local function";
> >      }
> >  
> > +  /* Functions calling BUILT_IN_VA_ARG_PACK and BUILT_IN_VA_ARG_PACK_LEN
> > +     works only when inlined.  Cloning them may still lead to better code
> 
> s/works/work/
> 
> > +     becuase ipa-cp will not give up on cloning further.  If the function is
> 
> s/becuase/because/
> 
> > +     external this however leads to wrong code becuase we may end up producing
> 
> s/becuase/because/

Thanks, fixed.

> 
> > +     offline copy of the function.  */
> > +  if (DECL_EXTERNAL (node->decl))
> > +    for (cgraph_edge *edge = node->callees; !reason && edge;
> > +	 edge = edge->next_callee)
> > +      if (DECL_BUILT_IN (edge->callee->decl)
> > +	  && DECL_BUILT_IN_CLASS (edge->callee->decl) == BUILT_IN_NORMAL)
> > +        {
> > +	  if (DECL_FUNCTION_CODE (edge->callee->decl) == BUILT_IN_VA_ARG_PACK)
> > +	    reason = "external function which calls va_arg_pack";
> > +	  if (DECL_FUNCTION_CODE (edge->callee->decl)
> > +	      == BUILT_IN_VA_ARG_PACK_LEN)
> > +	    reason = "external function which calls va_arg_pack_len";
> > +        }
> > +
> >    if (reason && dump_file && !node->alias && !node->thunk.thunk_p)
> >      fprintf (dump_file, "Function %s is not versionable, reason: %s.\n",
> >  	     node->dump_name (), reason);
> 
> Do you have a testcase for this, or is it LTO with too large input?

There is reduced testcase in the PR which probably should be rejected by C
frontend because it is uses va_arg_pack on non-variadic function.
I plan to send additional patches and then come with a testcase (because current
one should be early inlined and thus it will stop testing ipa-cp)

Honza

      reply	other threads:[~2018-02-21 20:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-21 19:09 Jan Hubicka
2018-02-21 22:49 ` Jakub Jelinek
2018-02-21 20:12   ` 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=20180221201224.GA49864@kam.mff.cuni.cz \
    --to=hubicka@ucw.cz \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.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).