From patchwork Thu Jul 12 10:29:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 942897 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-481416-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Y7A8hkPb"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41RBy86llhz9ryt for ; Thu, 12 Jul 2018 20:29:36 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=wQiiUq6bZOLTRJ/Xv+uspPPoD0oJFrX33S0J4ao3z4e42njJ9S QhFKtKuCM13NSGC1+AXWs+1QnnZv7GOxBKA+jzted0jymAs3lOhU5DZTBgoPWgPi Wwr6z72ygRhLUdVz1/sV1fxem3X+q46D+2RU+kroKlen0wHCOHgZyh1fE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=HGO/tepB8oaL8QvPJe092LIGQ3M=; b=Y7A8hkPb5sIrJc+o/eT+ GJOpikb7kXX2vnCqal8phskCuMA9N15i1tkzy4Lap6j+xXrLx3ukMmedTNcReQ1t h21yUpAvqTwK+0Z47KtZL44YjairOD0gUNqr4CuhYghgTFjHhau/Oi/8wlY/LJll eMoU0jGHm737f5+C0VHaDH8= Received: (qmail 88503 invoked by alias); 12 Jul 2018 10:29:26 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 88392 invoked by uid 89); 12 Jul 2018 10:29:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 12 Jul 2018 10:29:23 +0000 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 1C733ADC4; Thu, 12 Jul 2018 10:29:21 +0000 (UTC) Date: Thu, 12 Jul 2018 12:29:20 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org cc: Jakub Jelinek , jason@redhat.com Subject: [PATCH] Fix PR86462 Message-ID: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 After my PR86413 fix to always annotate existing lexical block DIEs with range attributes debuginfo grows significantly in case we previously had "stale" lexical block DIEs without any variables. The following fixes this by eliding those comletely and not emitting a lexical block DIE for blocks that just contain DECL_INGORED_P entities. This solves the reported size regression and the empty lexical block DIEs vanish. Bootstrap & regtest running on x86_64-unknown-linux-gnu. OK for trunk? Thanks, Richard. 2018-07-12 Richard Biener PR debug/86462 * dwarf2out.c (gen_block_die): Only output blocks when they have at least one !DECL_IGNORED_P variable. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 1127713cbaf..995a463bddc 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -25632,13 +25632,30 @@ gen_block_die (tree stmt, dw_die_ref context_die) /* Determine if this block directly contains any "significant" local declarations which we will need to output DIEs for. */ if (debug_info_level > DINFO_LEVEL_TERSE) - /* We are not in terse mode so *any* local declaration counts - as being a "significant" one. */ - must_output_die = ((BLOCK_VARS (stmt) != NULL - || BLOCK_NUM_NONLOCALIZED_VARS (stmt)) - && (TREE_USED (stmt) - || TREE_ASM_WRITTEN (stmt) - || BLOCK_ABSTRACT (stmt))); + { + /* We are not in terse mode so any local declaration that + is not ignored for debug purposes counts as being a + "significant" one. */ + if (TREE_USED (stmt) + || TREE_ASM_WRITTEN (stmt) + || BLOCK_ABSTRACT (stmt)) + { + for (tree var = BLOCK_VARS (stmt); var; var = DECL_CHAIN (var)) + if (!DECL_IGNORED_P (var)) + { + must_output_die = 1; + break; + } + if (!must_output_die) + for (unsigned i = 0; i < BLOCK_NUM_NONLOCALIZED_VARS (stmt); + ++i) + if (!DECL_IGNORED_P (BLOCK_NONLOCALIZED_VAR (stmt, i))) + { + must_output_die = 1; + break; + } + } + } else if ((TREE_USED (stmt) || TREE_ASM_WRITTEN (stmt) || BLOCK_ABSTRACT (stmt))