public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Eric Botcazou <ebotcazou@adacore.com>, Jeff Law <law@redhat.com>,
	    gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Improve seq_cost (PR middle-end/80929)
Date: Wed, 29 Nov 2017 09:46:00 -0000	[thread overview]
Message-ID: <alpine.LSU.2.20.1711291042470.12252@zhemvz.fhfr.qr> (raw)
In-Reply-To: <20171129080942.GT2353@tucnak>

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  <jakub@redhat.com>
> 
> 	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 <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)

      reply	other threads:[~2017-11-29  9:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-29  8:19 Jakub Jelinek
2017-11-29  9:46 ` Richard Biener [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LSU.2.20.1711291042470.12252@zhemvz.fhfr.qr \
    --to=rguenther@suse.de \
    --cc=ebotcazou@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=law@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).