From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15160 invoked by alias); 18 May 2011 09:39:36 -0000 Received: (qmail 15146 invoked by uid 22791); 18 May 2011 09:39:34 -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 09:39:17 +0000 Received: (qmail 953 invoked from network); 18 May 2011 09:39:16 -0000 Received: from unknown (HELO ?192.168.1.68?) (vries@127.0.0.2) by mail.codesourcery.com with ESMTPA; 18 May 2011 09:39:16 -0000 Message-ID: <4DD39392.7000400@codesourcery.com> Date: Wed, 18 May 2011 13:00:00 -0000 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: Re: [PATCH, PR45098, 3/10] References: <4DD21F6E.4050308@codesourcery.com> <4DD220C1.7000405@codesourcery.com> <20110518072620.GA18720@kam.mff.cuni.cz> In-Reply-To: <20110518072620.GA18720@kam.mff.cuni.cz> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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/msg01269.txt.bz2 Hi Zdenek, thanks for the review. On 05/18/2011 09:26 AM, Zdenek Dvorak wrote: >> 2011-05-05 Tom de Vries >> >> PR target/45098 >> * tree-ssa-loop-ivopts.c (computation_cost): Prevent cost of 0. > > this looks strange. Something like > > cost = seq_cost (seq, speed); > if (MEM_P (rslt)) > the current code; > else > cost += rtx_cost (rslt, SET, speed)); > > would make more sense to me (if I understand correctly what you are > trying to achieve). > Sorry for not putting an explanation in the first place. I'm trying to achieve that the cost of forcing an int into a reg is not 0. Currently, if the expansion results in an rtx expression rather than an insn, seq is NULL and seq_cost returns 0, after which computation_cost returns 0: ... (gdb) call debug_generic_expr (expr) 2000 (gdb) call debug_rtx (rslt) (const_int 2000 [0x7d0]) (gdb) p seq $5 = (rtx) 0x0 ... Using an assert on an x86_64 build, I found this case where seq != NULL_RTX: ... gdb) call debug_generic_expr (expr) (int) ((unsigned int) ivtmp.11 * 8) (gdb) call debug_rtx (rslt) (reg:SI 62) (gdb) call debug_rtx (seq) (insn 4 0 0 (parallel [ (set (reg:SI 62) (ashift:SI (subreg:SI (reg:DI 59 [ ivtmp.11 ]) 0) (const_int 3 [0x3]))) (clobber (reg:CC 17 flags)) ]) -1 (nil)) ... we don't need to additionally count a regcopy of r62 on top of seq_cost in this case. How about: ... @@ -2866,6 +2878,8 @@ computation_cost (tree expr, bool speed) if (MEM_P (rslt)) cost += address_cost (XEXP (rslt, 0), TYPE_MODE (type), TYPE_ADDR_SPACE (type), speed); + else if (!REG_P (rslt)) + cost += (unsigned)rtx_cost (rslt, SET, speed); return cost; } ... ? Thanks - Tom