public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Jason Merrill <jason@redhat.com>
Cc: Marek Polacek <polacek@redhat.com>,
	Richard Biener <rguenther@suse.de>,
	Nathaniel Shead <nathanieloshead@gmail.com>,
	gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] c++: End lifetime of objects in constexpr after destructor call [PR71093]
Date: Tue, 12 Dec 2023 00:03:10 +0100	[thread overview]
Message-ID: <ZXeVLl21Ty8j158k@tucnak> (raw)
In-Reply-To: <c9da4dcb-50cd-4c8f-af9d-37fabba36d39@redhat.com>

On Mon, Dec 11, 2023 at 05:00:50PM -0500, Jason Merrill wrote:
> In discussion of PR71093 it came up that more clobber_kind options would be
> useful within the C++ front-end.
> 
> gcc/ChangeLog:
> 
> 	* tree-core.h (enum clobber_kind): Rename CLOBBER_EOL to
> 	CLOBBER_STORAGE_END.  Add CLOBBER_STORAGE_BEGIN,
> 	CLOBBER_OBJECT_BEGIN, CLOBBER_OBJECT_END.
> 	* gimple-lower-bitint.cc
> 	* gimple-ssa-warn-access.cc
> 	* gimplify.cc
> 	* tree-inline.cc
> 	* tree-ssa-ccp.cc: Adjust for rename.

I doubt the above style will make it through the pre-commit hook, but I
might be wrong.

> --- a/gcc/gimple-lower-bitint.cc
> +++ b/gcc/gimple-lower-bitint.cc
> @@ -806,7 +806,7 @@ bitint_large_huge::handle_operand (tree op, tree idx)
>  	  && m_after_stmt
>  	  && bitmap_bit_p (m_single_use_names, SSA_NAME_VERSION (op)))
>  	{
> -	  tree clobber = build_clobber (TREE_TYPE (m_vars[p]), CLOBBER_EOL);
> +	  tree clobber = build_clobber (TREE_TYPE (m_vars[p]), CLOBBER_STORAGE_END);

This needs line wrapping I think.

> @@ -2100,7 +2100,7 @@ bitint_large_huge::handle_operand_addr (tree op, gimple *stmt,
>  	      ret = build_fold_addr_expr (var);
>  	      if (!stmt_ends_bb_p (gsi_stmt (m_gsi)))
>  		{
> -		  tree clobber = build_clobber (m_limb_type, CLOBBER_EOL);
> +		  tree clobber = build_clobber (m_limb_type, CLOBBER_STORAGE_END);

This too.

>  	      && flag_stack_reuse != SR_NONE)
>  	    {
> -	      tree clobber = build_clobber (TREE_TYPE (t), CLOBBER_EOL);
> +	      tree clobber = build_clobber (TREE_TYPE (t), CLOBBER_STORAGE_END);
>  	      gimple *clobber_stmt;
>  	      clobber_stmt = gimple_build_assign (t, clobber);
>  	      gimple_set_location (clobber_stmt, end_locus);
> @@ -7417,7 +7417,7 @@ gimplify_target_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
>  	{
>  	  if (flag_stack_reuse == SR_ALL)
>  	    {
> -	      tree clobber = build_clobber (TREE_TYPE (temp), CLOBBER_EOL);
> +	      tree clobber = build_clobber (TREE_TYPE (temp), CLOBBER_STORAGE_END);
>  	      clobber = build2 (MODIFY_EXPR, TREE_TYPE (temp), temp, clobber);
>  	      gimple_push_cleanup (temp, clobber, false, pre_p, true);
>  	    }

These too.

> diff --git a/gcc/tree-inline.cc b/gcc/tree-inline.cc
> index a4fc839a22d..cca3227fa89 100644
> --- a/gcc/tree-inline.cc
> +++ b/gcc/tree-inline.cc
> @@ -5136,7 +5136,7 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id,
>  	      && !is_gimple_reg (*varp)
>  	      && !(id->debug_map && id->debug_map->get (p)))
>  	    {
> -	      tree clobber = build_clobber (TREE_TYPE (*varp), CLOBBER_EOL);
> +	      tree clobber = build_clobber (TREE_TYPE (*varp), CLOBBER_STORAGE_END);
>  	      gimple *clobber_stmt;
>  	      clobber_stmt = gimple_build_assign (*varp, clobber);
>  	      gimple_set_location (clobber_stmt, gimple_location (stmt));
> @@ -5208,7 +5208,7 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id,
>  	  && !is_gimple_reg (id->retvar)
>  	  && !stmt_ends_bb_p (stmt))
>  	{
> -	  tree clobber = build_clobber (TREE_TYPE (id->retvar), CLOBBER_EOL);
> +	  tree clobber = build_clobber (TREE_TYPE (id->retvar), CLOBBER_STORAGE_END);
>  	  gimple *clobber_stmt;
>  	  clobber_stmt = gimple_build_assign (id->retvar, clobber);
>  	  gimple_set_location (clobber_stmt, gimple_location (old_stmt));

And these.

Otherwise LGTM.

	Jakub


  parent reply	other threads:[~2023-12-11 23:03 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-03  1:18 Nathaniel Shead
2023-11-03  1:34 ` Nathaniel Shead
2023-11-27 11:08   ` Nathaniel Shead
2023-12-09 20:12 ` Jason Merrill
2023-12-10 10:22   ` Richard Biener
2023-12-10 11:21     ` Alexander Monakov
2023-12-10 15:58       ` Richard Biener
2023-12-10 18:34     ` Jason Merrill
2023-12-11  8:02       ` Richard Biener
2023-12-11 19:12         ` Jason Merrill
2023-12-11 19:17           ` Richard Biener
2023-12-11 19:21             ` Marek Polacek
2023-12-11 22:00               ` Jason Merrill
2023-12-11 22:22                 ` Marek Polacek
2023-12-11 23:03                 ` Jakub Jelinek [this message]
2023-12-12 11:13                   ` Alexander Monakov
2023-12-12 11:15                     ` Jakub Jelinek
2023-12-12 15:24                       ` Jason Merrill
2023-12-12 17:50                         ` Jason Merrill
2023-12-13  4:40                           ` Jason Merrill
2023-12-13 16:47                             ` [pushed 1/4] c++: copy location to AGGR_INIT_EXPR Jason Merrill
2023-12-13 16:47                               ` [pushed 2/4] c++: constant direct-initialization [PR108243] Jason Merrill
2023-12-13 16:47                               ` [pushed 3/4] c++: fix in-charge parm in constexpr Jason Merrill
2023-12-13 16:47                               ` [pushed 4/4] c++: End lifetime of objects in constexpr after destructor call [PR71093] Jason Merrill
2023-12-13 18:05                               ` [pushed 1/4] c++: copy location to AGGR_INIT_EXPR Patrick Palka
2023-12-13 20:06                                 ` [pushed] c++: TARGET_EXPR location in default arg [PR96997] Jason Merrill
2023-12-14  0:00                               ` [pushed 1/4] c++: copy location to AGGR_INIT_EXPR Marek Polacek
2023-12-14  1:38                                 ` Jason Merrill
2023-12-14 14:25                                   ` Marek Polacek

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=ZXeVLl21Ty8j158k@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=nathanieloshead@gmail.com \
    --cc=polacek@redhat.com \
    --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).