From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 66623 invoked by alias); 21 Feb 2018 20:12:34 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 61028 invoked by uid 89); 21 Feb 2018 20:12:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.4 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:1852 X-HELO: nikam.ms.mff.cuni.cz Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 21 Feb 2018 20:12:26 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 89FCD546077; Wed, 21 Feb 2018 21:12:24 +0100 (CET) Date: Wed, 21 Feb 2018 20:12:00 -0000 From: Jan Hubicka To: Jakub Jelinek Cc: gcc-patches@gcc.gnu.org Subject: Re: PR84229 part 1: Avoid cloning of functions that calls va_arg_pack Message-ID: <20180221201224.GA49864@kam.mff.cuni.cz> References: <20180221190928.GA23794@kam.mff.cuni.cz> <20180221191308.GR5867@tucnak> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180221191308.GR5867@tucnak> User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2018-02/txt/msg01243.txt.bz2 > 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