public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Alexandre Oliva <aoliva@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/users/aoliva/heads/testme)] drop va_list from formals if requested
Date: Sat, 10 Jul 2021 00:08:35 +0000 (GMT)	[thread overview]
Message-ID: <20210710000835.525263853839@sourceware.org> (raw)

https://gcc.gnu.org/g:4adeb16e622d8b8b92fd0611a889108cebddaa3e

commit 4adeb16e622d8b8b92fd0611a889108cebddaa3e
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Fri Jul 9 19:54:42 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 26b02d7aa95..75b5a47a7ae 100644
--- a/gcc/ipa-param-manipulation.c
+++ b/gcc/ipa-param-manipulation.c
@@ -283,14 +283,17 @@ fill_vector_of_new_param_types (vec<tree> *new_types, vec<tree> *otypes,
 
 static tree
 build_adjusted_function_type (tree orig_type, vec<tree> *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],
@@ -458,8 +461,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
@@ -1309,8 +1314,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 f605e763f4a..0e9bb622421 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -2793,7 +2793,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;


             reply	other threads:[~2021-07-10  0:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-10  0:08 Alexandre Oliva [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-04-06 15:02 Alexandre Oliva
2021-07-10  9:43 Alexandre Oliva
2021-06-28 15:42 Alexandre Oliva

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=20210710000835.525263853839@sourceware.org \
    --to=aoliva@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /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).