aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.h
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2019-07-25 11:36:38 +0200
committerMartin Liska <marxin@gcc.gnu.org>2019-07-25 09:36:38 +0000
commit6343b6bf3bb83c87cfc80eb32400b45bebd571e0 (patch)
tree6c52e67da842981920f45c39ce059391d48a4e97 /gcc/tree.h
parentcb50701ec2c7abdc48db278802022f7e94675d07 (diff)
downloadgcc-6343b6bf3bb83c87cfc80eb32400b45bebd571e0.zip
gcc-6343b6bf3bb83c87cfc80eb32400b45bebd571e0.tar.gz
gcc-6343b6bf3bb83c87cfc80eb32400b45bebd571e0.tar.bz2
Extend DCE to remove unnecessary new/delete-pairs (PR c++/23383).
2019-07-25 Martin Liska <mliska@suse.cz> Dominik Infuhr <dominik.infuehr@theobroma-systems.com> PR c++/23383 * common.opt: Add -fallocation-dce * gimple.c (gimple_call_operator_delete_p): New. * gimple.h (gimple_call_operator_delete_p): Likewise. * tree-core.h (enum function_decl_type): Add OPERATOR_DELETE. * tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Handle DECL_IS_OPERATOR_DELETE_P. (mark_all_reaching_defs_necessary_1): Likewise. (propagate_necessity): Likewise. (eliminate_unnecessary_stmts): Handle gimple_call_operator_delete_p. * tree-streamer-in.c (unpack_ts_function_decl_value_fields): Add packing of OPERATOR_DELETE. * tree-streamer-out.c (pack_ts_function_decl_value_fields): Similarly here. * tree.h (DECL_IS_OPERATOR_DELETE_P): New. (DECL_SET_IS_OPERATOR_DELETE): New. (DECL_IS_REPLACEABLE_OPERATOR_NEW_P): Likewise. 2019-07-25 Martin Liska <mliska@suse.cz> Dominik Infuhr <dominik.infuehr@theobroma-systems.com> PR c++/23383 * c-decl.c (merge_decls): Merge OPERATOR_DELETE flag. 2019-07-25 Martin Liska <mliska@suse.cz> Dominik Infuhr <dominik.infuehr@theobroma-systems.com> PR c++/23383 * decl.c (cxx_init_decl_processing): Mark delete operators with DECL_SET_IS_OPERATOR_DELETE. 2019-07-25 Martin Liska <mliska@suse.cz Dominik Infuhr <dominik.infuehr@theobroma-systems.com> PR c++/23383 * g++.dg/cpp1y/new1.C: New test. 2019-07-25 Martin Liska <mliska@suse.cz> Dominik Infuhr <dominik.infuehr@theobroma-systems.com> PR c++/23383 * testsuite/ext/bitmap_allocator/check_delete.cc: Add -fno-allocation-dce. * testsuite/ext/bitmap_allocator/check_new.cc: Likewise. * testsuite/ext/new_allocator/check_delete.cc: Likewise. * testsuite/ext/new_allocator/check_new.cc: Likewise. Co-Authored-By: Dominik Infuehr <dominik.infuehr@theobroma-systems.com> From-SVN: r273791
Diffstat (limited to 'gcc/tree.h')
-rw-r--r--gcc/tree.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/tree.h b/gcc/tree.h
index 81c11a4..4aa2c4a 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -3020,9 +3020,20 @@ set_function_decl_type (tree decl, function_decl_type t, bool set)
#define DECL_IS_OPERATOR_NEW_P(NODE) \
(FUNCTION_DECL_CHECK (NODE)->function_decl.decl_type == OPERATOR_NEW)
+#define DECL_IS_REPLACEABLE_OPERATOR_NEW_P(NODE) \
+ (DECL_IS_OPERATOR_NEW_P (NODE) && DECL_IS_MALLOC (NODE))
+
#define DECL_SET_IS_OPERATOR_NEW(NODE, VAL) \
set_function_decl_type (FUNCTION_DECL_CHECK (NODE), OPERATOR_NEW, VAL)
+/* Nonzero in a FUNCTION_DECL means this function should be treated as
+ C++ operator delete. */
+#define DECL_IS_OPERATOR_DELETE_P(NODE) \
+ (FUNCTION_DECL_CHECK (NODE)->function_decl.decl_type == OPERATOR_DELETE)
+
+#define DECL_SET_IS_OPERATOR_DELETE(NODE, VAL) \
+ set_function_decl_type (FUNCTION_DECL_CHECK (NODE), OPERATOR_DELETE, VAL)
+
/* Nonzero in a FUNCTION_DECL means this function may return more
than once. */
#define DECL_IS_RETURNS_TWICE(NODE) \