diff options
author | Jason Merrill <jason@redhat.com> | 2020-10-02 09:00:49 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2020-10-02 11:22:20 +0200 |
commit | 4f4ced28826ece7b7b76649522ee2a9601a63b90 (patch) | |
tree | 4fe85bc7a6d70681537bfe2d93b32fbd39ad5a8c /gcc/tree-ssa-dce.c | |
parent | 0b945f959f03a6185a3130f30bfd524d01d4142c (diff) | |
download | gcc-4f4ced28826ece7b7b76649522ee2a9601a63b90.zip gcc-4f4ced28826ece7b7b76649522ee2a9601a63b90.tar.gz gcc-4f4ced28826ece7b7b76649522ee2a9601a63b90.tar.bz2 |
c++: Set CALL_FROM_NEW_OR_DELETE_P on more calls.
We were failing to set the flag on a delete call in a new expression, in a
deleting destructor, and in a coroutine. Fixed by setting it in the
function that builds the call.
2020-10-02 Jason Merril <jason@redhat.com>
gcc/cp/ChangeLog:
* call.c (build_operator_new_call): Set CALL_FROM_NEW_OR_DELETE_P.
(build_op_delete_call): Likewise.
* init.c (build_new_1, build_vec_delete_1, build_delete): Not here.
(build_delete):
gcc/ChangeLog:
* gimple.h (gimple_call_operator_delete_p): Rename from
gimple_call_replaceable_operator_delete_p.
* gimple.c (gimple_call_operator_delete_p): Likewise.
* tree.h (DECL_IS_REPLACEABLE_OPERATOR_DELETE_P): Remove.
* tree-ssa-dce.c (mark_all_reaching_defs_necessary_1): Adjust.
(propagate_necessity): Likewise.
(eliminate_unnecessary_stmts): Likewise.
* tree-ssa-structalias.c (find_func_aliases_for_call): Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/pr94314.C: new/delete no longer omitted.
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 c9e0c8f..a046612 100644 --- a/gcc/tree-ssa-dce.c +++ b/gcc/tree-ssa-dce.c @@ -612,7 +612,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_REPLACEABLE_OPERATOR_DELETE_P (callee)) + || DECL_IS_OPERATOR_DELETE_P (callee)) && gimple_call_from_new_or_delete (call)) return false; } @@ -877,7 +877,7 @@ propagate_necessity (bool aggressive) bool is_delete_operator = (is_gimple_call (stmt) && gimple_call_from_new_or_delete (as_a <gcall *> (stmt)) - && gimple_call_replaceable_operator_delete_p (as_a <gcall *> (stmt))); + && gimple_call_operator_delete_p (as_a <gcall *> (stmt))); if (is_delete_operator || gimple_call_builtin_p (stmt, BUILT_IN_FREE)) { @@ -975,7 +975,7 @@ propagate_necessity (bool aggressive) if (callee != NULL_TREE && (DECL_IS_REPLACEABLE_OPERATOR_NEW_P (callee) - || DECL_IS_REPLACEABLE_OPERATOR_DELETE_P (callee)) + || DECL_IS_OPERATOR_DELETE_P (callee)) && gimple_call_from_new_or_delete (call)) continue; @@ -1402,7 +1402,7 @@ eliminate_unnecessary_stmts (void) && (gimple_call_builtin_p (stmt, BUILT_IN_FREE) || (is_gimple_call (stmt) && gimple_call_from_new_or_delete (as_a <gcall *> (stmt)) - && gimple_call_replaceable_operator_delete_p (as_a <gcall *> (stmt))))) + && gimple_call_operator_delete_p (as_a <gcall *> (stmt))))) { tree ptr = gimple_call_arg (stmt, 0); if (TREE_CODE (ptr) == SSA_NAME) |