diff mbox

Fix PR80929: Realistic PARALLEL cost in seq_cost.

Message ID 14699546-2dd9-29d7-93f8-ef893fe513ed@gjlay.de
State New
Headers show

Commit Message

Georg-Johann Lay June 2, 2017, 7:53 a.m. UTC
Hi,

this small addition improves costs of PARALLELs in
rtlanal.c:seq_cost().  Up to now, these costs are
assumed to be 1 which gives gross inexact costs for,
e.g. divmod which is represented as PARALLEL.

The patch just forwards cost computation to insn_rtx_cost
which uses the cost of the 1st SET (if any) and otherwise
assign costs of 1 insn.

Bootstrapped & regtested on x86_64.

Moreover, it fixed the division by constant on avr where
the problem popped up since PR79665.

Ok to install?

Johann

gcc/
	PR middle-end/80929
	* rtlanal.c (seq_cost) [PARALLEL]: Get cost from insn_rtx_cost
	instead of assuming cost of 1.

Comments

Georg-Johann Lay June 9, 2017, 10:35 a.m. UTC | #1
Ping #1

https://gcc.gnu.org/ml/gcc-patches/2017-06/msg00096.html

On 02.06.2017 09:53, Georg-Johann Lay wrote:
> Hi,
>
> this small addition improves costs of PARALLELs in
> rtlanal.c:seq_cost().  Up to now, these costs are
> assumed to be 1 which gives gross inexact costs for,
> e.g. divmod which is represented as PARALLEL.
>
> The patch just forwards cost computation to insn_rtx_cost
> which uses the cost of the 1st SET (if any) and otherwise
> assign costs of 1 insn.
>
> Bootstrapped & regtested on x86_64.
>
> Moreover, it fixed the division by constant on avr where
> the problem popped up since PR79665.
>
> Ok to install?
>
> Johann
>
> gcc/
>     PR middle-end/80929
>     * rtlanal.c (seq_cost) [PARALLEL]: Get cost from insn_rtx_cost
>     instead of assuming cost of 1.
>
diff mbox

Patch

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 += insn_rtx_cost (PATTERN (seq), speed);
       else
         cost++;
     }