diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-04-14 19:21:31 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-04-14 19:21:31 +0000 |
commit | 402d7a9016137f127e279883fd901f44463b94b2 (patch) | |
tree | 689f794a5cd438e124194ffde1382c3f023c5bf2 /gcc/ipa-polymorphic-call.c | |
parent | 4c1007f11e4c4ff880b06488b10117c36c46238e (diff) | |
download | gcc-402d7a9016137f127e279883fd901f44463b94b2.tar.gz |
PR c++/70594
* ipa-utils.h (polymorphic_ctor_dtor_p): New prototype.
* ipa-polymorphic-call.c (polymorphic_ctor_dtor_p): New function.
(inlined_polymorphic_ctor_dtor_block_p): Use it.
* tree-ssa-live.c (remove_unused_scope_block_p): When
in_ctor_dtor_block, avoid discarding not just BLOCKs with
BLOCK_ABSTRACT_ORIGIN being FUNCTION_DECL, but even when
block_ultimate_origin is FUNCTION_DECL.
(remove_unused_locals): If current_function_decl is
polymorphic_ctor_dtor_p, pass initial true to
remove_unused_scope_block_p' is_ctor_dtor_block.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234987 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-polymorphic-call.c')
-rw-r--r-- | gcc/ipa-polymorphic-call.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/gcc/ipa-polymorphic-call.c b/gcc/ipa-polymorphic-call.c index 0ebbd4ae66d..56f334471de 100644 --- a/gcc/ipa-polymorphic-call.c +++ b/gcc/ipa-polymorphic-call.c @@ -479,16 +479,12 @@ contains_type_p (tree outer_type, HOST_WIDE_INT offset, } -/* Return a FUNCTION_DECL if BLOCK represents a constructor or destructor. +/* Return a FUNCTION_DECL if FN represent a constructor or destructor. If CHECK_CLONES is true, also check for clones of ctor/dtors. */ tree -inlined_polymorphic_ctor_dtor_block_p (tree block, bool check_clones) +polymorphic_ctor_dtor_p (tree fn, bool check_clones) { - tree fn = block_ultimate_origin (block); - if (fn == NULL || TREE_CODE (fn) != FUNCTION_DECL) - return NULL_TREE; - if (TREE_CODE (TREE_TYPE (fn)) != METHOD_TYPE || (!DECL_CXX_CONSTRUCTOR_P (fn) && !DECL_CXX_DESTRUCTOR_P (fn))) { @@ -510,6 +506,19 @@ inlined_polymorphic_ctor_dtor_block_p (tree block, bool check_clones) return fn; } +/* Return a FUNCTION_DECL if BLOCK represents a constructor or destructor. + If CHECK_CLONES is true, also check for clones of ctor/dtors. */ + +tree +inlined_polymorphic_ctor_dtor_block_p (tree block, bool check_clones) +{ + tree fn = block_ultimate_origin (block); + if (fn == NULL || TREE_CODE (fn) != FUNCTION_DECL) + return NULL_TREE; + + return polymorphic_ctor_dtor_p (fn, check_clones); +} + /* We know that the instance is stored in variable or parameter (not dynamically allocated) and we want to disprove the fact |