From patchwork Wed May 18 16:50:49 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 96195 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 4A8CA1007D5 for ; Thu, 19 May 2011 02:52:14 +1000 (EST) Received: (qmail 1693 invoked by alias); 18 May 2011 16:52:02 -0000 Received: (qmail 1505 invoked by uid 22791); 18 May 2011 16:52:00 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL, BAYES_00, TW_EG, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 18 May 2011 16:51:46 +0000 Received: (qmail 16074 invoked from network); 18 May 2011 16:51:45 -0000 Received: from unknown (HELO ?192.168.1.68?) (vries@127.0.0.2) by mail.codesourcery.com with ESMTPA; 18 May 2011 16:51:45 -0000 Message-ID: <4DD3F8E9.6000004@codesourcery.com> Date: Wed, 18 May 2011 18:50:49 +0200 From: Tom de Vries User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110424 Lightning/1.0b2 Thunderbird/3.1.10 MIME-Version: 1.0 To: Zdenek Dvorak CC: gcc-patches@gcc.gnu.org Subject: [PATCH PR45098, 4/10] Iv init cost. References: <4DD21F6E.4050308@codesourcery.com> <4DD22110.1040001@codesourcery.com> In-Reply-To: <4DD22110.1040001@codesourcery.com> 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 On 05/17/2011 09:17 AM, Tom de Vries wrote: > On 05/17/2011 09:10 AM, Tom de Vries wrote: >> Hi Zdenek, >> >> I have a patch set for for PR45098. >> >> 01_object-size-target.patch >> 02_pr45098-rtx-cost-set.patch >> 03_pr45098-computation-cost.patch >> 04_pr45098-iv-init-cost.patch >> 05_pr45098-bound-cost.patch >> 06_pr45098-bound-cost.test.patch >> 07_pr45098-nowrap-limits-iterations.patch >> 08_pr45098-nowrap-limits-iterations.test.patch >> 09_pr45098-shift-add-cost.patch >> 10_pr45098-shift-add-cost.test.patch >> >> I will sent out the patches individually. >> > > OK for trunk? > > Thanks, > - Tom 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. 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);