public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Improve seq_cost (PR middle-end/80929)
@ 2017-11-29  8:19 Jakub Jelinek
  2017-11-29  9:46 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2017-11-29  8:19 UTC (permalink / raw)
  To: Richard Biener, Eric Botcazou, Jeff Law; +Cc: gcc-patches

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  <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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-29  9:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-29  8:19 [PATCH] Improve seq_cost (PR middle-end/80929) Jakub Jelinek
2017-11-29  9:46 ` Richard Biener

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).