From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 64790 invoked by alias); 29 Nov 2017 09:43:00 -0000 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 Received: (qmail 64770 invoked by uid 89); 29 Nov 2017 09:43:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.7 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KB_WAM_FROM_NAME_SINGLEWORD,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:1370 X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 29 Nov 2017 09:42:58 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 00996ABD9; Wed, 29 Nov 2017 09:42:54 +0000 (UTC) Date: Wed, 29 Nov 2017 09:46:00 -0000 From: Richard Biener To: Jakub Jelinek cc: Eric Botcazou , Jeff Law , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Improve seq_cost (PR middle-end/80929) In-Reply-To: <20171129080942.GT2353@tucnak> Message-ID: References: <20171129080942.GT2353@tucnak> User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-SW-Source: 2017-11/txt/msg02481.txt.bz2 On Wed, 29 Nov 2017, Jakub Jelinek wrote: > Hi! > > This PR complains that seq_cost counts all non-single_set insns as 1 > unconditionally, which is indeed bad. For some like compare + arithmetics > we even have now code in pattern_cost that handles those reasonably by > default, for others targets have the option through a hook to return > whatever they want. > > On the other side, IMNSHO we don't want to count CODE_LABELs, NOTEs, > BARRIERs, DEBUG_INSNs... > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? Works for me. Thanks, Richard. > 2017-11-29 Jakub Jelinek > > PR middle-end/80929 > * rtlanal.c (seq_cost): For non-single_set insns try to use insn_cost. > > --- gcc/rtlanal.c.jj 2017-10-27 14:16:39.000000000 +0200 > +++ gcc/rtlanal.c 2017-11-27 13:35:46.321509933 +0100 > @@ -5342,7 +5342,13 @@ seq_cost (const rtx_insn *seq, bool spee > if (set) > cost += set_rtx_cost (set, speed); > - else > - cost++; > + else if (NONDEBUG_INSN_P (seq)) > + { > + int this_cost = insn_cost (CONST_CAST_RTX_INSN (seq), speed); > + if (this_cost > 0) > + cost += this_cost; > + else > + cost++; > + } > } > > return cost; > > Jakub > > -- Richard Biener SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)