From patchwork Thu Dec 13 09:39:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 205789 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 79DE82C0091 for ; Thu, 13 Dec 2012 20:40:15 +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=1355996415; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc: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=kcULJUM/0GKCmCMe+mFU fGT7qSU=; b=WbtXg5S/FcteCVeBbFJXiRQc7RosBHqZjI3I2sctCkMa10zcCAOH RkuWTmo+qQLf3c/PaGqcJzY+iVVRf442ULRKORrJ5/Y7gEKGd6uKCf31Cgp2ZGvc YnwPTExXGxsKlozHdqxorFx8PpyHzz4fLVTU2JR4IuB0Lxo53Poihkw= 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:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To:MIME-Version:Content-Type:Content-Disposition:User-Agent:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=RzF2ntkW/JNIw7UY7a2rfmsqoPYcT5v3Zz9t4LYN05VrCCKM7R3Ol2lL4kLvrn g6GPA5qB9RWRobbbFkDbMh+IKmZhoO5w0pwZsqOVQUMYgumUAiz762/kgMD7cnQF rOWqiFz6uyq0WirGgAI0EZipDUemniYct0OdUgu8kpl38=; Received: (qmail 3671 invoked by alias); 13 Dec 2012 09:40:08 -0000 Received: (qmail 3659 invoked by uid 22791); 13 Dec 2012 09:40:07 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 13 Dec 2012 09:39:57 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qBD9dvEP007650 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 13 Dec 2012 04:39:57 -0500 Received: from zalov.redhat.com (vpn1-5-170.ams2.redhat.com [10.36.5.170]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id qBD9dtG2004837 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 13 Dec 2012 04:39:56 -0500 Received: from zalov.cz (localhost [127.0.0.1]) by zalov.redhat.com (8.14.5/8.14.5) with ESMTP id qBD9dsel029171; Thu, 13 Dec 2012 10:39:55 +0100 Received: (from jakub@localhost) by zalov.cz (8.14.5/8.14.5/Submit) id qBD9dsgY029170; Thu, 13 Dec 2012 10:39:54 +0100 Date: Thu, 13 Dec 2012 10:39:54 +0100 From: Jakub Jelinek To: Alexandre Oliva Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Add --param max-vartrack-reverse-op-size=N (PR debug/54402) Message-ID: <20121213093954.GN2315@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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! As the PR54402 go testcase shows, sometimes we end up with VALUEs with huge (many thousands) long locs lists because we add too many reverse ops for the same value. Such huge locs lists of equivalences are hardly useful in practice, reverse ops mainly help when there are just a few locs and most of them don't have a register or memory location, and make e.g. find_base_term or get_addr extremely expensive. The following patch avoids adding further reverse op equivalences for VALUEs if the locs list is already big enough, the default value of 50 makes the go1 testcase significantly faster, but debug info/debug_loc size on x86_64-linux as well as i686-linux was identical (for cc1plus/go1/libstdc++.so.6 I've checked) between default of 50 and 1000, so I assume it didn't affect debug info quality for those, and hope it is unlikely it will for other real-world programs. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2012-12-12 Jakub Jelinek PR debug/54402 * params.def (PARAM_MAX_VARTRACK_REVERSE_OP_SIZE): New param. * var-tracking.c (reverse_op): Don't add reverse ops to VALUEs that have already PARAM_VALUE (PARAM_MAX_VARTRACK_REVERSE_OP_SIZE) or longer locs list. Jakub --- gcc/params.def.jj 2012-11-23 10:01:50.000000000 +0100 +++ gcc/params.def 2012-12-12 16:26:21.063473958 +0100 @@ -869,6 +869,14 @@ DEFPARAM (PARAM_MAX_VARTRACK_EXPR_DEPTH, "Max. recursion depth for expanding var tracking expressions", 12, 0, 0) +/* Set maximum length of value location list for which var tracking + should add reverse operations. */ + +DEFPARAM (PARAM_MAX_VARTRACK_REVERSE_OP_SIZE, + "max-vartrack-reverse-op-size", + "Max. size of loc list for which reverse ops should be added", + 50, 0, 0) + /* Set minimum insn uid for non-debug insns. */ DEFPARAM (PARAM_MIN_NONDEBUG_INSN_UID, --- gcc/var-tracking.c.jj 2012-12-12 15:57:29.000000000 +0100 +++ gcc/var-tracking.c 2012-12-12 16:28:27.089745791 +0100 @@ -5545,6 +5545,7 @@ reverse_op (rtx val, const_rtx expr, rtx cselib_val *v; struct elt_loc_list *l; enum rtx_code code; + int count; if (GET_CODE (expr) != SET) return; @@ -5586,10 +5587,13 @@ reverse_op (rtx val, const_rtx expr, rtx /* Adding a reverse op isn't useful if V already has an always valid location. Ignore ENTRY_VALUE, while it is always constant, we should prefer non-ENTRY_VALUE locations whenever possible. */ - for (l = v->locs; l; l = l->next) + for (l = v->locs, count = 0; l; l = l->next, count++) if (CONSTANT_P (l->loc) && (GET_CODE (l->loc) != CONST || !references_value_p (l->loc, 0))) return; + /* Avoid creating too large locs lists. */ + else if (count == PARAM_VALUE (PARAM_MAX_VARTRACK_REVERSE_OP_SIZE)) + return; switch (GET_CODE (src)) {