From patchwork Thu Jun 29 08:51:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georg-Johann Lay X-Patchwork-Id: 782110 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wytgY4yy5z9ryr for ; Thu, 29 Jun 2017 18:51:36 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="jILxxz+I"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; q=dns; s= default; b=gUsDprsWBDDJr3nPar0Dz/kB4R+msU5D2fUzpdhRZDwUTYPPSVjL1 2We/4/jTz90F5v6R9mw9070FdmdgnEnlRs/BsmOA6AU+khbJHMoByxtIQKMa2I3x uF7hdZK8dIbiksL9EA+gr97D+LlRes/csL+lXRW0A4I6zYXHXLdrds= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=default; bh=cHXypAbDWab8ooAqDS/14md528U=; b=jILxxz+IAeDK1cpWEvN2P5e6j3Y2 ASFgOnZRnp59MRB1gaOdu0pnU9/hrX7w/3AcSav05vzEgWnBlsL7SUZzg1w0SA0Q H5JVw/io5C4ph8TvNhlWp++ZiIboiWfOR/vRweGc2jr8wHEVXbziW1VIsVVJF9mB MZv3lxIhH6NstRU= Received: (qmail 121315 invoked by alias); 29 Jun 2017 08:51:27 -0000 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 Received: (qmail 121299 invoked by uid 89); 29 Jun 2017 08:51:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-12.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=Hx-languages-length:1543 X-HELO: mo4-p00-ob.smtp.rzone.de Received: from mo4-p00-ob.smtp.rzone.de (HELO mo4-p00-ob.smtp.rzone.de) (81.169.146.220) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 29 Jun 2017 08:51:24 +0000 X-RZG-AUTH: :LXoWVUeid/7A29J/hMvvT3ol15ykJcYwR/bcHRirORRW3yMcVao= X-RZG-CLASS-ID: mo00 Received: from [192.168.0.123] (mail.hightec-rt.com [213.135.1.215]) by smtp.strato.de (RZmta 41.0 DYNA|AUTH) with ESMTPSA id 301555t5T8pKn3e (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Thu, 29 Jun 2017 10:51:20 +0200 (CEST) Subject: Re: [patch][Ping #3] PR80929: Realistic PARALLEL cost in seq_cost. To: Wilco Dijkstra , GCC Patches Cc: nd , Jeff Law , "ian@airs.com" References: From: Georg-Johann Lay Message-ID: <0aec7558-7895-b01d-408d-3b0c00e6509f@gjlay.de> Date: Thu, 29 Jun 2017 10:51:20 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: X-IsSubscribed: yes On 28.06.2017 22:18, Wilco Dijkstra wrote: > Georg-Johann Lay wrote: > > @@ -5300,6 +5300,9 @@ seq_cost (const rtx_insn *seq, bool spee > set = single_set (seq); > if (set) > cost += set_rtx_cost (set, speed); > + else if (INSN_P (seq) > + && PARALLEL == GET_CODE (PATTERN (seq))) > + cost += insn_rtx_cost (PATTERN (seq), speed); > else > cost++; > > insn_rtx_cost may return zero if it can't find something useful in the parallel, > which means it may return a lower cost and even zero. Not sure whether this > is important, but in eg. combine a cost of zero means infinite and so could have > unintended consequences. So incrementing cost with a non-zero value > if insn_rtx_cost == 0 would seem safer. Updated patch below, it just adds 1 (which is 1/4 of CONST_N_INSNS) to avoid zero. > Also why does the else do cost++ and not cost += COSTS_N_INSNS (1)? > > Wilco Dunno, I didn't change this. Maybe it's also just to escape 0. Johann gcc/ PR middle-end/80929 * rtlanal.c (seq_cost) [PARALLEL]: Get cost from insn_rtx_cost instead of assuming cost of 1. Index: rtlanal.c =================================================================== --- rtlanal.c (revision 248745) +++ rtlanal.c (working copy) @@ -5300,6 +5300,9 @@ seq_cost (const rtx_insn *seq, bool spee set = single_set (seq); if (set) cost += set_rtx_cost (set, speed); + else if (INSN_P (seq) + && PARALLEL == GET_CODE (PATTERN (seq))) + cost += 1 + insn_rtx_cost (PATTERN (seq), speed); else cost++; }