From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17212 invoked by alias); 18 May 2011 20:53:16 -0000 Received: (qmail 17200 invoked by uid 22791); 18 May 2011 20:53:16 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,TW_EG,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 18 May 2011 20:53:01 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 29025) id 748EB9AC834; Wed, 18 May 2011 22:52:59 +0200 (CEST) Date: Wed, 18 May 2011 22:59:00 -0000 From: Zdenek Dvorak To: Tom de Vries Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH PR45098, 4/10] Iv init cost. Message-ID: <20110518205259.GA10227@kam.mff.cuni.cz> References: <4DD21F6E.4050308@codesourcery.com> <4DD22110.1040001@codesourcery.com> <4DD3F8E9.6000004@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4DD3F8E9.6000004@codesourcery.com> User-Agent: Mutt/1.5.18 (2008-05-17) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-05/txt/msg01338.txt.bz2 Hi, > Resubmitting with comment. > > The init cost of an iv will in general not be zero. It will be > exceptional that the iv register happens to be initialized with the > proper value at no cost. In general, there will at the very least be a > regcopy or a const set. OK. Please add a comment explaining this to the code, Zdenek > 2011-05-05 Tom de Vries > > PR target/45098 > * tree-ssa-loop-ivopts.c (determine_iv_cost): Prevent > cost_base.cost == 0. > Index: gcc/tree-ssa-loop-ivopts.c > =================================================================== > --- gcc/tree-ssa-loop-ivopts.c (revision 173380) > +++ gcc/tree-ssa-loop-ivopts.c (working copy) > @@ -4688,6 +4688,8 @@ determine_iv_cost (struct ivopts_data *d > > base = cand->iv->base; > cost_base = force_var_cost (data, base, NULL); > + if (cost_base.cost == 0) > + cost_base.cost = COSTS_N_INSNS (1); > cost_step = add_cost (TYPE_MODE (TREE_TYPE (base)), data->speed); > > cost = cost_step + adjust_setup_cost (data, cost_base.cost);