From 967ca9b932e2f1b137c4e8b414146b06e1cad45c Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 14 Apr 2016 21:21:31 +0200 Subject: re PR c++/70594 (-fcompare-debug failure) 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. From-SVN: r234987 --- gcc/tree-ssa-live.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'gcc/tree-ssa-live.c') diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c index c76051a..15fc43f 100644 --- a/gcc/tree-ssa-live.c +++ b/gcc/tree-ssa-live.c @@ -393,14 +393,16 @@ remove_unused_scope_block_p (tree scope, bool in_ctor_dtor_block) in_ctor_dtor_block = true; unused = false; } - /* 2) inside such blocks, the outermost block with BLOCK_ABSTRACT_ORIGIN + /* 2) inside such blocks, the outermost block with block_ultimate_origin being a FUNCTION_DECL. */ - else if (in_ctor_dtor_block - && BLOCK_ABSTRACT_ORIGIN (scope) - && TREE_CODE (BLOCK_ABSTRACT_ORIGIN (scope)) == FUNCTION_DECL) + else if (in_ctor_dtor_block) { - in_ctor_dtor_block = false; - unused = false; + tree fn = block_ultimate_origin (scope); + if (fn && TREE_CODE (fn) == FUNCTION_DECL) + { + in_ctor_dtor_block = false; + unused = false; + } } for (t = &BLOCK_VARS (scope); *t; t = next) @@ -855,7 +857,9 @@ remove_unused_locals (void) cfun->local_decls->truncate (dstidx); } - remove_unused_scope_block_p (DECL_INITIAL (current_function_decl), false); + remove_unused_scope_block_p (DECL_INITIAL (current_function_decl), + polymorphic_ctor_dtor_p (current_function_decl, + true) != NULL_TREE); clear_unused_block_pointer (); BITMAP_FREE (usedvars); -- cgit v1.1