From: Tom de Vries <Tom_deVries@mentor.com>
To: Michael Matz <matz@suse.de>
Cc: Richard Biener <rguenther@suse.de>,
Jakub Jelinek <jakub@redhat.com>,
GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH][5/5] Postpone expanding va_arg until pass_stdarg
Date: Mon, 23 Feb 2015 10:36:00 -0000 [thread overview]
Message-ID: <54EAFC5B.1030003@mentor.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1502230909590.18611@wotan.suse.de>
[-- Attachment #1: Type: text/plain, Size: 464 bytes --]
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.
Thanks,
- Tom
[-- Attachment #2: 0006-Set-PROP_gimple_lva-for-functions-without-IFN_VA_ARG.patch --]
[-- Type: text/x-patch, Size: 2329 bytes --]
2015-02-23 Tom de Vries <tom@codesourcery.com>
* 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
next prev parent reply other threads:[~2015-02-23 10:19 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-19 10:48 [stage1] " Tom de Vries
2015-02-19 10:51 ` [PATCH][1/5] Disable lang_hooks.gimplify_expr in free_lang_data Tom de Vries
2015-02-19 12:41 ` Richard Biener
2015-02-19 10:59 ` [PATCH][2/5] Add gimple_find_sub_bbs Tom de Vries
2015-02-19 12:41 ` Richard Biener
2015-02-19 12:51 ` Jakub Jelinek
2015-02-19 13:03 ` Marek Polacek
2015-02-19 13:31 ` Richard Biener
2015-02-19 13:07 ` Richard Biener
2015-02-22 12:47 ` Tom de Vries
2015-02-19 11:06 ` [PATCH][3/5] Factor optimize_va_list_gpr_fpr_size out of pass_stdarg::execute Tom de Vries
2015-02-19 12:44 ` Richard Biener
2015-02-19 11:37 ` [PATCH][4/5] Handle internal_fn in operand_equal_p Tom de Vries
2015-02-19 12:49 ` Richard Biener
2015-02-19 12:59 ` Jakub Jelinek
2015-02-19 13:09 ` Richard Biener
2015-02-19 15:31 ` Tom de Vries
2015-02-20 11:59 ` Richard Biener
2015-02-22 13:13 ` Tom de Vries
2015-02-23 10:19 ` Richard Biener
2015-02-24 13:09 ` Fwd: " Tom de Vries
2015-02-19 12:08 ` [PATCH][5/5] Postpone expanding va_arg until pass_stdarg Tom de Vries
2015-02-19 13:05 ` Richard Biener
2015-02-22 13:24 ` Tom de Vries
2015-02-23 9:03 ` Michael Matz
2015-02-23 10:36 ` Tom de Vries [this message]
2015-02-24 8:26 ` Tom de Vries
2015-03-10 15:31 ` [PING] [PATCH][5b/5] Avoid running expand_ifn_va_arg_1 in functions without va_arg Tom de Vries
2015-04-16 8:50 ` [PING^2] " Tom de Vries
2015-04-16 8:56 ` Richard Biener
2015-03-10 15:31 ` [PING] [PATCH][5a/5] Postpone expanding va_arg until pass_stdarg Tom de Vries
2015-04-16 8:50 ` [PING^2] " Tom de Vries
2015-04-16 8:55 ` Richard Biener
2015-04-21 5:32 ` Bin.Cheng
2015-06-09 11:04 ` Alan Lawrence
2015-06-09 11:07 ` Richard Biener
2015-06-09 13:03 ` Tom de Vries
2015-06-09 13:07 ` Richard Biener
2015-06-09 13:30 ` Alan Lawrence
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=54EAFC5B.1030003@mentor.com \
--to=tom_devries@mentor.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=matz@suse.de \
--cc=rguenther@suse.de \
/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).