From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 90158 invoked by alias); 10 Mar 2015 15:31:29 -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 90144 invoked by uid 89); 10 Mar 2015 15:31:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 10 Mar 2015 15:31:28 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1YVM7x-0001ox-0r from Tom_deVries@mentor.com ; Tue, 10 Mar 2015 08:31:25 -0700 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.224.2; Tue, 10 Mar 2015 15:31:23 +0000 Message-ID: <54FF0E47.2070200@mentor.com> Date: Tue, 10 Mar 2015 15:31:00 -0000 From: Tom de Vries User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Richard Biener , Jakub Jelinek CC: Michael Matz , GCC Patches Subject: [PING] [PATCH][5b/5] Avoid running expand_ifn_va_arg_1 in functions without va_arg References: <54E5BB06.2080102@mentor.com> <54E5D0D2.8080306@mentor.com> <54E9D5E2.3070805@mentor.com> <54EAFC5B.1030003@mentor.com> <54EC1ECB.5030609@mentor.com> In-Reply-To: <54EC1ECB.5030609@mentor.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2015-03/txt/msg00571.txt.bz2 [stage1 ping] [was: Postpone expanding va_arg until pass_stdarg] On 24-02-15 07:48, Tom de Vries wrote: > On 23-02-15 11:09, Tom de Vries wrote: >> On 23-02-15 09:26, Michael Matz wrote: >>> Hi, >>> >>> On Sun, 22 Feb 2015, Tom de Vries wrote: >>> >>>> Btw, I'm wondering if as run-time optimization we can tentatively set >>>> PROP_gimple_lva at the start of the gimple pass, and unset it in >>>> gimplify_va_arg_expr. That way we would avoid the loop in >>>> expand_ifn_va_arg_1 (over all bbs and gimples) in functions without >>>> va_arg. >>> >>> That makes sense. >>> >> >> I'll put this follow-up patch through testing. > > Bootstrapped and reg-tested as before together with the rest of the patch series. > > OK for stage1? > Ping. Thanks, - Tom > 0006-Set-PROP_gimple_lva-for-functions-without-IFN_VA_ARG.patch > > > 2015-02-23 Tom de Vries > > * gimplify.c (gimplify_function_tree): Tentatively set PROP_gimple_lva > in cfun->curr_properties. > (gimplify_va_arg_expr): Clear PROP_gimple_lva in cfun->curr_properties > if we generate an IFN_VA_ARG. > * tree-inline.c (expand_call_inline): Reset PROP_gimple_lva in dest > function if PROP_gimple_lva is not set in src function. > --- > gcc/gimplify.c | 10 +++++++++- > gcc/tree-inline.c | 8 ++++++++ > 2 files changed, 17 insertions(+), 1 deletion(-) > > diff --git a/gcc/gimplify.c b/gcc/gimplify.c > index 8ac6a35..497e2fa 100644 > --- a/gcc/gimplify.c > +++ b/gcc/gimplify.c > @@ -9218,6 +9218,10 @@ gimplify_function_tree (tree fndecl) > else > push_struct_function (fndecl); > > + /* Tentatively set PROP_gimple_lva here, and reset it in gimplify_va_arg_expr > + if necessary. */ > + cfun->curr_properties |= PROP_gimple_lva; > + > for (parm = DECL_ARGUMENTS (fndecl); parm ; parm = DECL_CHAIN (parm)) > { > /* Preliminarily mark non-addressed complex variables as eligible > @@ -9312,7 +9316,7 @@ gimplify_function_tree (tree fndecl) > } > > DECL_SAVED_TREE (fndecl) = NULL_TREE; > - cfun->curr_properties = PROP_gimple_any; > + cfun->curr_properties |= PROP_gimple_any; > > pop_cfun (); > } > @@ -9431,6 +9435,10 @@ gimplify_va_arg_expr (tree *expr_p, gimple_seq *pre_p, > tag = build_int_cst (build_pointer_type (type), 0); > *expr_p = build_call_expr_internal_loc (loc, IFN_VA_ARG, type, 2, ap, tag); > > + /* Clear the tentatively set PROP_gimple_lva, to indicate that IFN_VA_ARG > + needs to be expanded. */ > + cfun->curr_properties &= ~PROP_gimple_lva; > + > return GS_OK; > } > > diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c > index d8abe03..7dfef4f 100644 > --- a/gcc/tree-inline.c > +++ b/gcc/tree-inline.c > @@ -4524,6 +4524,14 @@ expand_call_inline (basic_block bb, gimple stmt, copy_body_data *id) > id->src_cfun = DECL_STRUCT_FUNCTION (fn); > id->call_stmt = stmt; > > + /* If the the src function contains an IFN_VA_ARG, then so will the dst > + function after inlining. */ > + if ((id->src_cfun->curr_properties & PROP_gimple_lva) == 0) > + { > + struct function *dst_cfun = DECL_STRUCT_FUNCTION (id->dst_fn); > + dst_cfun->curr_properties &= ~PROP_gimple_lva; > + } > + > gcc_assert (!id->src_cfun->after_inlining); > > id->entry_bb = bb; > -- 1.9.1 >