From patchwork Wed Nov 28 20:54:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 202547 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 681222C007B for ; Thu, 29 Nov 2012 07:54:35 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1354740875; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Date:From:To:Subject:Message-ID:Reply-To:MIME-Version: Content-Type:Content-Disposition:User-Agent:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=vv8+P1NptMnk2pjbhWpGVf8O7m4=; b=W+cM4K5ANivVczxlD+geaEUdiPH/UgXNdjxsqAROZbMrGwkyM8q51k0XBp8laV TgENMsY9TTm3QKBYdgEESiWuXPia7k9DnwEB1rgZOzn+EVY+Th5DkQ/3hpLHVkJx Y1azc9+qpV5Bo2+YMm/boa4+/Wgnm+3c9TdT84Zb3ppQ4= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:X-ExtLoop1:Received:Received:Date:From:To:Subject:Message-ID:Reply-To:MIME-Version:Content-Type:Content-Disposition:User-Agent:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=oGnhGEIdxJysckk0cTn48xDjuQgjtgXMxXU7ybNzpOr53GYg6gDhj8JrLTrEWK xUujK/uYDPxBiZ1uowoixrwFYPB76siEx92405LAst86FToCwzIbD91CbDgdFi0i R1byAFnvxY3HwZxIBy5+w+DYLJa+O/C0PAYQZLLm7WO7o=; Received: (qmail 4336 invoked by alias); 28 Nov 2012 20:54:32 -0000 Received: (qmail 4325 invoked by uid 22791); 28 Nov 2012 20:54:32 -0000 X-SWARE-Spam-Status: No, hits=-5.3 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, NO_DNS_FOR_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mga01.intel.com (HELO mga01.intel.com) (192.55.52.88) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 28 Nov 2012 20:54:27 +0000 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 28 Nov 2012 12:54:26 -0800 X-ExtLoop1: 1 Received: from gnu-6.sc.intel.com ([10.3.194.135]) by fmsmga002.fm.intel.com with ESMTP; 28 Nov 2012 12:54:12 -0800 Received: by gnu-6.sc.intel.com (Postfix, from userid 500) id C88F58099B; Wed, 28 Nov 2012 12:54:12 -0800 (PST) Date: Wed, 28 Nov 2012 12:54:12 -0800 From: "H.J. Lu" To: gcc-patches@gcc.gnu.org Subject: PATCH: Don't scan all global declarations for nothing Message-ID: <20121128205412.GA5694@intel.com> Reply-To: "H.J. Lu" MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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 Hi, When we are generating debug info, we still scan all global declarations and call debug_nothing_tree on each declaration. It is a waste of time and can add up when there are many global declarations. This patch skips the scan if debug_hooks->global_decl == &debug_nothing_tree. OK to install? Thanks. H.J. --- 2012-11-28 H.J. Lu * toplev.c (emit_debug_global_declarations): Don't scan all global declarations for nothing. c/ 2012-11-28 H.J. Lu * c-decl.c (c_write_global_declarations): Don't call c_write_global_declarations_2 for nothing. diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index b1c88bd..a546e1f 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -10124,7 +10124,8 @@ c_write_global_declarations (void) /* After cgraph has had a chance to emit everything that's going to be emitted, output debug information for globals. */ - if (!seen_error ()) + if (debug_hooks->global_decl != &debug_nothing_tree + && !seen_error ()) { timevar_push (TV_SYMOUT); FOR_EACH_VEC_ELT (*all_translation_units, i, t) diff --git a/gcc/toplev.c b/gcc/toplev.c index 2c2898c..c203460 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -521,8 +521,10 @@ emit_debug_global_declarations (tree *vec, int len) { int i; - /* Avoid confusing the debug information machinery when there are errors. */ - if (seen_error ()) + /* Avoid confusing the debug information machinery when there are + errors. Don't scan all global declarations for nothing. */ + if (debug_hooks->global_decl == &debug_nothing_tree + || seen_error ()) return; timevar_push (TV_SYMOUT);