From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 116935 invoked by alias); 24 Feb 2015 06:48:56 -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 116925 invoked by uid 89); 24 Feb 2015 06:48:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 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, 24 Feb 2015 06:48:52 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-02.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1YQ9IV-0006Un-Rj from Tom_deVries@mentor.com ; Mon, 23 Feb 2015 22:48:48 -0800 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-02.mgc.mentorg.com (137.202.0.106) with Microsoft SMTP Server id 14.3.224.2; Tue, 24 Feb 2015 06:48:46 +0000 Message-ID: <54EC1ECB.5030609@mentor.com> Date: Tue, 24 Feb 2015 08:26:00 -0000 From: Tom de Vries User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Richard Biener , Jakub Jelinek CC: Michael Matz , GCC Patches Subject: Re: [PATCH][5/5] Postpone expanding va_arg until pass_stdarg References: <54E5BB06.2080102@mentor.com> <54E5D0D2.8080306@mentor.com> <54E9D5E2.3070805@mentor.com> <54EAFC5B.1030003@mentor.com> In-Reply-To: <54EAFC5B.1030003@mentor.com> Content-Type: multipart/mixed; boundary="------------020600040604050606040108" X-SW-Source: 2015-02/txt/msg01404.txt.bz2 --------------020600040604050606040108 Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Content-length: 619 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? Thanks, - Tom --------------020600040604050606040108 Content-Type: text/x-patch; name="0006-Set-PROP_gimple_lva-for-functions-without-IFN_VA_ARG.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0006-Set-PROP_gimple_lva-for-functions-without-IFN_VA_ARG.pa"; filename*1="tch" Content-length: 2329 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 --------------020600040604050606040108--