DCE enhancement to delete dead vptr assignment
Xinliang David Li
davidxl@google.com
Fri Apr 16 16:29:00 GMT 2010
This is related to PR34949. It makes use C++ language semantics.
Currently it handles empty dtors or their inline instances into
deleting dtors or inline instances into callers followed by delete
call. It will extend automatically to handle other cases (e.g. dtor
with printf statement etc) when more precise alias/mod-ref or builtin
function side effect information is available.
bootstrap and regression on x86-64/linux
Ok for mainline?
Thanks,
David
-------------- next part --------------
2010-04-15 Xinliang David Li <davidxl@google.com>
* tree-ssa-dce.c (find_base_ptr): New function.
(is_killed_by_delete): New function.
(mark_operand_necessary): Handle vptr field assignment.
(mark_stmt_if_obviously_necessary): Handle vptr field assignment.
* langhooks.c (lhs_do_nothing_t_return_false): New function.
* langhooks.h: New lang hooks.
* tree-flow.h: New interfaces.
* gimple.c (is_vptr_init): New function.
(is_vptr_access): New function.
(is_global_delete_call): New function.
(points_to_vbtl): New function.
* cp/cp-lang.c (cp_is_decl_dtor_p): New function.
(cp_is_vptr_field_p): New function.
(cp_is_polymorphic_type_p): New function.
(cp_is_global_delete_fndecl_p): New function.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vptr_dce.p
Type: text/x-pascal
Size: 15141 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100416/d5f87d3d/attachment.bin>
-------------- next part --------------
2010-04-15 Xinliang David Li <davidxl@google.com>
* g++.dg/tree-ssa/vptr_init_dse.C: New test.
* g++.dg/tree-ssa/vptr_init_dse2.C: New test.
* g++.dg/tree-ssa/vptr_init_dse3.C: New test.
* g++.dg/tree-ssa/vptr_init_dse4.C: New test.
More information about the Gcc-patches
mailing list