https://gcc.gnu.org/bugzilla/show_bug.cgi?id=23383

--- Comment #28 from Martin Liška <marxin at gcc dot gnu.org> ---
Author: marxin
Date: Thu Jul 25 09:36:38 2019
New Revision: 273791

URL: https://gcc.gnu.org/viewcvs?rev=273791&root=gcc&view=rev
Log:
Extend DCE to remove unnecessary new/delete-pairs (PR c++/23383).

2019-07-25  Martin Liska  <mli...@suse.cz>
            Dominik Infuhr  <dominik.infu...@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  <mli...@suse.cz>
            Dominik Infuhr  <dominik.infu...@theobroma-systems.com>

        PR c++/23383
        * c-decl.c (merge_decls): Merge OPERATOR_DELETE flag.
2019-07-25  Martin Liska  <mli...@suse.cz>
            Dominik Infuhr  <dominik.infu...@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  <mli...@suse.cz
            Dominik Infuhr  <dominik.infu...@theobroma-systems.com>

        PR c++/23383
        * g++.dg/cpp1y/new1.C: New test.
2019-07-25  Martin Liska  <mli...@suse.cz>
            Dominik Infuhr  <dominik.infu...@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.

Added:
    trunk/gcc/testsuite/g++.dg/cpp1y/new1.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c/ChangeLog
    trunk/gcc/c/c-decl.c
    trunk/gcc/common.opt
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/gimple.c
    trunk/gcc/gimple.h
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-core.h
    trunk/gcc/tree-ssa-dce.c
    trunk/gcc/tree-streamer-in.c
    trunk/gcc/tree-streamer-out.c
    trunk/gcc/tree.h
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/testsuite/ext/bitmap_allocator/check_delete.cc
    trunk/libstdc++-v3/testsuite/ext/bitmap_allocator/check_new.cc
    trunk/libstdc++-v3/testsuite/ext/new_allocator/check_delete.cc
    trunk/libstdc++-v3/testsuite/ext/new_allocator/check_new.cc

Reply via email to