From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2140) id 2A5683987C33; Mon, 28 Jun 2021 15:42:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2A5683987C33 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Alexandre Oliva To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/aoliva/heads/testme)] drop va_list from formals if requested X-Act-Checkin: gcc X-Git-Author: Alexandre Oliva X-Git-Refname: refs/users/aoliva/heads/testme X-Git-Oldrev: b54230f5409463ba380a83a7569ec1de7b88cb35 X-Git-Newrev: 0749cb49a28e394161aec95506cc71c9f490c07c Message-Id: <20210628154228.2A5683987C33@sourceware.org> Date: Mon, 28 Jun 2021 15:42:28 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jun 2021 15:42:28 -0000 https://gcc.gnu.org/g:0749cb49a28e394161aec95506cc71c9f490c07c commit 0749cb49a28e394161aec95506cc71c9f490c07c Author: Alexandre Oliva Date: Mon Jun 28 12:40:31 2021 -0300 drop va_list from formals if requested Diff: --- gcc/ipa-param-manipulation.c | 17 ++++++++++++----- gcc/tree-inline.c | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/gcc/ipa-param-manipulation.c b/gcc/ipa-param-manipulation.c index f2d91476655..85c0f29dcd5 100644 --- a/gcc/ipa-param-manipulation.c +++ b/gcc/ipa-param-manipulation.c @@ -209,14 +209,17 @@ fill_vector_of_new_param_types (vec *new_types, vec *otypes, static tree build_adjusted_function_type (tree orig_type, vec *new_param_types, - bool method2func, bool skip_return) + bool method2func, bool skip_return, + bool skip_valist) { tree new_arg_types = NULL; if (TYPE_ARG_TYPES (orig_type)) { gcc_checking_assert (new_param_types); - bool last_parm_void = (TREE_VALUE (tree_last (TYPE_ARG_TYPES (orig_type))) - == void_type_node); + bool last_parm_void = (skip_valist + || (TREE_VALUE (tree_last (TYPE_ARG_TYPES + (orig_type))) + == void_type_node)); unsigned len = new_param_types->length (); for (unsigned i = 0; i < len; i++) new_arg_types = tree_cons (NULL_TREE, (*new_param_types)[i], @@ -384,8 +387,10 @@ ipa_param_adjustments::build_new_function_type (tree old_type, else new_param_types_p = NULL; + bool skip_valist = m_always_copy_start < 0; return build_adjusted_function_type (old_type, new_param_types_p, - method2func_p (old_type), m_skip_return); + method2func_p (old_type), m_skip_return, + skip_valist); } /* Build variant of function decl ORIG_DECL which has no return value if @@ -1257,8 +1262,10 @@ ipa_param_body_adjustments::modify_formal_parameters () through tree_function_versioning, not when modifying function body directly. */ gcc_assert (!m_adjustments || !m_adjustments->m_skip_return); + bool skip_valist = m_adjustments && m_adjustments->m_always_copy_start < 0; tree new_type = build_adjusted_function_type (orig_type, &m_new_types, - m_method2func, false); + m_method2func, false, + skip_valist); TREE_TYPE (m_fndecl) = new_type; DECL_VIRTUAL_P (m_fndecl) = 0; diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 9e041ca4d56..9a559847caa 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -2781,7 +2781,7 @@ initialize_cfun (tree new_fndecl, tree callee_fndecl, profile_count count) cfun->va_list_fpr_size = src_cfun->va_list_fpr_size; cfun->has_nonlocal_label = src_cfun->has_nonlocal_label; cfun->calls_eh_return = src_cfun->calls_eh_return; - cfun->stdarg = src_cfun->stdarg; + cfun->stdarg = src_cfun->stdarg && stdarg_p (TREE_TYPE (new_fndecl)); cfun->after_inlining = src_cfun->after_inlining; cfun->can_throw_non_call_exceptions = src_cfun->can_throw_non_call_exceptions;