diff options
author | Martin Liska <mliska@suse.cz> | 2020-04-08 17:16:55 +0200 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2020-04-08 17:16:55 +0200 |
commit | 70df40cab6f268ba7f05c6d1421928cca0834ee3 (patch) | |
tree | 6e450dab8ef417ec03b6fbee3f5deeffcd5284bf /gcc/tree-ssa-dce.c | |
parent | e18cd376e0d5ffc2a2b21eba0c396a771c30e1d4 (diff) | |
download | gcc-70df40cab6f268ba7f05c6d1421928cca0834ee3.zip gcc-70df40cab6f268ba7f05c6d1421928cca0834ee3.tar.gz gcc-70df40cab6f268ba7f05c6d1421928cca0834ee3.tar.bz2 |
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.
Diffstat (limited to 'gcc/tree-ssa-dce.c')
-rw-r--r-- | gcc/tree-ssa-dce.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c index e4077b5..fd5f24c 100644 --- a/gcc/tree-ssa-dce.c +++ b/gcc/tree-ssa-dce.c @@ -614,7 +614,7 @@ mark_all_reaching_defs_necessary_1 (ao_ref *ref ATTRIBUTE_UNUSED, if (callee != NULL_TREE && (DECL_IS_REPLACEABLE_OPERATOR_NEW_P (callee) - || DECL_IS_OPERATOR_DELETE_P (callee))) + || DECL_IS_REPLACEABLE_OPERATOR_DELETE_P (callee))) return false; } @@ -806,7 +806,7 @@ propagate_necessity (bool aggressive) processing the argument. */ bool is_delete_operator = (is_gimple_call (stmt) - && gimple_call_operator_delete_p (as_a <gcall *> (stmt))); + && gimple_call_replaceable_operator_delete_p (as_a <gcall *> (stmt))); if (is_delete_operator || gimple_call_builtin_p (stmt, BUILT_IN_FREE)) { @@ -896,7 +896,7 @@ propagate_necessity (bool aggressive) if (callee != NULL_TREE && (DECL_IS_REPLACEABLE_OPERATOR_NEW_P (callee) - || DECL_IS_OPERATOR_DELETE_P (callee))) + || DECL_IS_REPLACEABLE_OPERATOR_DELETE_P (callee))) continue; /* Calls implicitly load from memory, their arguments @@ -1321,7 +1321,7 @@ eliminate_unnecessary_stmts (void) if (gimple_plf (stmt, STMT_NECESSARY) && (gimple_call_builtin_p (stmt, BUILT_IN_FREE) || (is_gimple_call (stmt) - && gimple_call_operator_delete_p (as_a <gcall *> (stmt))))) + && gimple_call_replaceable_operator_delete_p (as_a <gcall *> (stmt))))) { tree ptr = gimple_call_arg (stmt, 0); if (TREE_CODE (ptr) == SSA_NAME) |