public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@ucw.cz>
To: "Martin Liška" <mliska@suse.cz>
Cc: Jason Merrill <jason@redhat.com>,
	Jakub Jelinek <jakub@redhat.com>,
	Richard Biener <richard.guenther@gmail.com>,
	Marc Glisse <marc.glisse@inria.fr>,
	Jonathan Wakely <jwakely.gcc@gmail.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>,
	Nathan Sidwell <nathan@acm.org>
Subject: Re: [PATCH] Allow new/delete operator deletion only for replaceable.
Date: Wed, 8 Apr 2020 17:46:52 +0200	[thread overview]
Message-ID: <20200408154652.GB87486@kam.mff.cuni.cz> (raw)
In-Reply-To: <e832e47e-451e-8b17-f4d0-5bfc93c9b97f@suse.cz>


> From 2f8ba3418f10b41bb839aadb292447bd757238d0 Mon Sep 17 00:00:00 2001
> From: Martin Liska <mliska@suse.cz>
> Date: Tue, 7 Apr 2020 16:23:27 +0200
> Subject: [PATCH] Allow new/delete operator deletion only for replaceable.
> 
> gcc/ChangeLog:
> 
> 2020-04-07  Martin Liska  <mliska@suse.cz>
> 
> 	PR c++/94314
> 	* gimple.c (gimple_call_operator_delete_p): Rename to...
> 	(gimple_call_replaceable_operator_delete_p): ... this.
> 	Use DECL_IS_REPLACEABLE_OPERATOR_DELETE_P.
> 	* gimple.h (gimple_call_operator_delete_p): Rename to ...
> 	(gimple_call_replaceable_operator_delete_p): ... this.
> 	* tree-core.h (tree_function_decl): Add replaceable_operator
> 	flag.
> 	* tree-ssa-dce.c (mark_all_reaching_defs_necessary_1):
> 	Use DECL_IS_REPLACEABLE_OPERATOR_DELETE_P.
> 	(propagate_necessity): Use gimple_call_replaceable_operator_delete_p.
> 	(eliminate_unnecessary_stmts): Likewise.
> 	* tree-streamer-in.c (unpack_ts_function_decl_value_fields):
> 	Pack DECL_IS_REPLACEABLE_OPERATOR.
> 	* tree-streamer-out.c (pack_ts_function_decl_value_fields):
> 	Unpack the field here.
> 	* tree.h (DECL_IS_REPLACEABLE_OPERATOR): New.
> 	(DECL_IS_REPLACEABLE_OPERATOR_NEW_P): New.
> 	(DECL_IS_REPLACEABLE_OPERATOR_DELETE_P): New.
> 	* cgraph.c (cgraph_node::dump): Dump if an operator is replaceable.
> 	* ipa-icf.c (sem_item::compare_referenced_symbol_properties): Compare
> 	replaceable operator flags.
> 
> gcc/cp/ChangeLog:
> 
> 2020-04-07  Martin Liska  <mliska@suse.cz>
> 
> 	PR c++/94314
> 	* decl.c (duplicate_decls): Duplicate also DECL_IS_REPLACEABLE_OPERATOR.
> 	(cxx_init_decl_processing): Mark replaceable all implicitly defined
> 	operators.
> 
> gcc/lto/ChangeLog:
> 
> 2020-04-07  Martin Liska  <mliska@suse.cz>
> 
> 	PR c++/94314
> 	* lto-common.c (compare_tree_sccs_1): Compare also
> 	DECL_IS_REPLACEABLE_OPERATOR.
> 
> gcc/testsuite/ChangeLog:
> 
> 2020-04-07  Martin Liska  <mliska@suse.cz>
> 
> 	PR c++/94314
> 	* g++.dg/pr94314-2.C: New test.
> 	* g++.dg/pr94314-3.C: New test.
> 	* g++.dg/pr94314.C: New test.
> @@ -2368,6 +2368,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
>  	    DECL_SET_IS_OPERATOR_NEW (newdecl, true);
>  	  DECL_LOOPING_CONST_OR_PURE_P (newdecl)
>  	    |= DECL_LOOPING_CONST_OR_PURE_P (olddecl);
> +	  DECL_IS_REPLACEABLE_OPERATOR (newdecl)
> +	    |= DECL_IS_REPLACEABLE_OPERATOR (olddecl);
>  
>  	  if (merge_attr)
>  	    merge_attribute_bits (newdecl, olddecl);

I think you will also need to take care of decl copying tht happens in
the midle-end.  If we do ipa-cp clone of the replaceable operator I
guess we want to copy the flag since it is still new/delete
(removeing it in dce has still the same semantics)

However if we split the function, I think we want to remove the flag
from foo.part clone, or one would be able to again produce the examples
with broken reference counting by making ipa-split to separate the
refernece count and tail of the function.

I am not quite sure about the offloading done by openMP - I think that
one produces new decls.

Honza

  reply	other threads:[~2020-04-08 15:46 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-30  8:40 [PATCH] Check DECL_CONTEXT of new/delete operators Martin Liška
2020-03-30  8:53 ` Richard Biener
2020-03-31 12:29   ` Jan Hubicka
2020-03-31 12:38     ` Martin Liška
2020-04-03 15:26       ` Jan Hubicka
2020-04-03 15:42         ` Jan Hubicka
2020-04-04 11:53           ` Jan Hubicka
2020-04-06  9:27             ` Richard Biener
2020-04-06 15:10               ` Jason Merrill
2020-04-06  8:34         ` Martin Liška
2020-04-06 12:45           ` Nathan Sidwell
2020-04-07  8:26             ` Jonathan Wakely
2020-04-07  9:29               ` Richard Biener
2020-04-07  9:49                 ` Jan Hubicka
2020-04-07 10:22                   ` Richard Biener
2020-04-07 10:42                     ` Martin Liška
2020-04-07 11:41                 ` Jonathan Wakely
2020-04-07 10:46             ` Martin Liška
2020-04-07 11:29             ` Jonathan Wakely
2020-04-07 11:40               ` Richard Biener
2020-04-07 11:46                 ` Jonathan Wakely
2020-04-07 11:57                   ` Richard Biener
2020-04-07 15:00                     ` [PATCH] Allow new/delete operator deletion only for replaceable Martin Liška
2020-04-08  8:47                       ` Richard Biener
2020-04-08 13:20                         ` Jason Merrill
2020-04-08 13:32                           ` Jakub Jelinek
2020-04-08 13:34                             ` Jason Merrill
2020-04-08 15:16                               ` Martin Liška
2020-04-08 15:46                                 ` Jan Hubicka [this message]
2020-04-08 16:06                                   ` Jakub Jelinek
2020-04-09  5:05                                 ` Martin Liška
2020-04-09  6:45                                   ` Richard Biener
2020-04-09  6:59                                     ` Martin Liška
2020-04-09  7:21                                       ` Richard Biener
2020-04-09  7:55                                       ` Jakub Jelinek
2020-04-09  8:04                                     ` Marc Glisse
2020-04-09  8:13                                       ` Jonathan Wakely
2020-04-10  8:08                                         ` Martin Liška
2020-04-10  8:18                                           ` Jonathan Wakely
2020-04-10  8:29                                             ` Martin Liška
2020-04-10  9:17                                               ` Jakub Jelinek
2020-04-14  7:09                                                 ` Martin Liška
2020-04-14  7:11                                                   ` Martin Liška
2020-04-14  8:37                                                     ` Jakub Jelinek
2020-04-14 10:54                                                       ` Martin Liška
2020-04-17  7:05                                                         ` Jakub Jelinek
2020-04-17  8:12                                                           ` Jonathan Wakely
2020-04-10  8:37                                           ` Marc Glisse
2020-04-10  9:11                                             ` Iain Sandoe
2020-04-09 16:55                                   ` Jason Merrill
2020-04-07 15:16                     ` [PATCH] Check DECL_CONTEXT of new/delete operators Jonathan Wakely
2020-04-08  7:34                       ` Richard Biener
2020-04-08  8:11                         ` Jonathan Wakely
2020-04-07 14:11               ` Nathan Sidwell
2020-03-30  9:29 ` Marc Glisse

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=20200408154652.GB87486@kam.mff.cuni.cz \
    --to=hubicka@ucw.cz \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=jason@redhat.com \
    --cc=jwakely.gcc@gmail.com \
    --cc=marc.glisse@inria.fr \
    --cc=mliska@suse.cz \
    --cc=nathan@acm.org \
    --cc=richard.guenther@gmail.com \
    /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).