From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18207 invoked by alias); 25 May 2011 13:45:04 -0000 Received: (qmail 18161 invoked by uid 22791); 25 May 2011 13:45:03 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,TW_EG X-Spam-Check-By: sourceware.org Received: from mail-ww0-f51.google.com (HELO mail-ww0-f51.google.com) (74.125.82.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 25 May 2011 13:44:49 +0000 Received: by wwf26 with SMTP id 26so7760697wwf.8 for ; Wed, 25 May 2011 06:44:48 -0700 (PDT) Received: by 10.227.198.133 with SMTP id eo5mr2266178wbb.38.1306331087856; Wed, 25 May 2011 06:44:47 -0700 (PDT) Received: from richards-thinkpad (gbibp9ph1--blueice2n1.emea.ibm.com [195.212.29.75]) by mx.google.com with ESMTPS id 14sm382440wbw.40.2011.05.25.06.44.45 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 25 May 2011 06:44:46 -0700 (PDT) From: Richard Sandiford To: Tom de Vries Mail-Followup-To: Tom de Vries ,Zdenek Dvorak , gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Cc: Zdenek Dvorak , gcc-patches@gcc.gnu.org Subject: Re: [PATCH PR45098, 4/10] Iv init cost. References: <4DD21F6E.4050308@codesourcery.com> <4DD22110.1040001@codesourcery.com> <4DD3F8E9.6000004@codesourcery.com> Date: Wed, 25 May 2011 14:20:00 -0000 In-Reply-To: <4DD3F8E9.6000004@codesourcery.com> (Tom de Vries's message of "Wed, 18 May 2011 18:50:49 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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/msg01848.txt.bz2 Sorry for being so late. I was just curious... Tom de Vries writes: > 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. > > 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); ...why does this reasoning apply only to this call to force_var_cost? Richard