From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1776 invoked by alias); 29 Nov 2017 08:09:57 -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 1172 invoked by uid 89); 29 Nov 2017 08:09:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.7 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,KB_WAM_FROM_NAME_SINGLEWORD,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:1086 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 29 Nov 2017 08:09:55 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D277779704; Wed, 29 Nov 2017 08:09:53 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-77.ams2.redhat.com [10.36.116.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 69091600D1; Wed, 29 Nov 2017 08:09:53 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id vAT89iGU022361; Wed, 29 Nov 2017 09:09:49 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id vAT89g4I022360; Wed, 29 Nov 2017 09:09:42 +0100 Date: Wed, 29 Nov 2017 08:19:00 -0000 From: Jakub Jelinek To: Richard Biener , Eric Botcazou , Jeff Law Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Improve seq_cost (PR middle-end/80929) Message-ID: <20171129080942.GT2353@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.7.1 (2016-10-04) X-IsSubscribed: yes X-SW-Source: 2017-11/txt/msg02472.txt.bz2 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? 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