Allow new/delete operator deletion only for replaceable.
authorMartin Liska <mliska@suse.cz>
Wed, 8 Apr 2020 15:16:55 +0000 (17:16 +0200)
committerMartin Liska <mliska@suse.cz>
Wed, 8 Apr 2020 15:16:55 +0000 (17:16 +0200)
commit70df40cab6f268ba7f05c6d1421928cca0834ee3
tree6e450dab8ef417ec03b6fbee3f5deeffcd5284bf
parente18cd376e0d5ffc2a2b21eba0c396a771c30e1d4
Allow new/delete operator deletion only for replaceable.

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.
PR c++/94314
* decl.c (duplicate_decls): Duplicate also DECL_IS_REPLACEABLE_OPERATOR.
(cxx_init_decl_processing): Mark replaceable all implicitly defined
operators.
PR c++/94314
* lto-common.c (compare_tree_sccs_1): Compare also
DECL_IS_REPLACEABLE_OPERATOR.
PR c++/94314
* g++.dg/pr94314-2.C: New test.
* g++.dg/pr94314-3.C: New test.
* g++.dg/pr94314.C: New test.
18 files changed:
gcc/ChangeLog
gcc/cgraph.c
gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/gimple.c
gcc/gimple.h
gcc/ipa-icf.c
gcc/lto/ChangeLog
gcc/lto/lto-common.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/pr94314-2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/pr94314-3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/pr94314.C [new file with mode: 0644]
gcc/tree-core.h
gcc/tree-ssa-dce.c
gcc/tree-streamer-in.c
gcc/tree-streamer-out.c
gcc/tree.h