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++;
     }

Reply via email to