https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83913

Andrey Belevantsev <abel at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |abel at gcc dot gnu.org

--- Comment #3 from Andrey Belevantsev <abel at gcc dot gnu.org> ---
We've discussed with Alexander about this one.  The simpler fix will be never
pipelining anything of priority 0, as this wouldn't give any benefit.  The
better fix is to make bookkeeping copies within the pipelined region inherit
sched_times -- the number of times this insn was scheduled.  It will not work
for regular scheduling as those new insns have to be scheduled at some point,
but for pipelined regions we're rescheduling blocks with new insns anyways.  So
something like below works, but for that kind of patch I will need testing on
ia64 and it takes time.

diff --git a/gcc/sel-sched.c b/gcc/sel-sched.c
index 76092f9587a..58f4ca4016f 100644
--- a/gcc/sel-sched.c
+++ b/gcc/sel-sched.c
@@ -4773,7 +4773,16 @@ emit_bookkeeping_insn (insn_t place_to_insert, expr_t
c_expr, int new_seqno)
   insn_t new_insn = emit_insn_from_expr_after (c_expr, new_vinsn, new_seqno,
                                               place_to_insert);

-  INSN_SCHED_TIMES (new_insn) = 0;
+  if (pipelining_p && !sel_is_loop_preheader_p (BLOCK_FOR_INSN
(place_to_insert)))
+    {
+      int sched_times = EXPR_SCHED_TIMES (c_expr);
+      if (sched_times < 0)
+       sched_times = 0;
+      INSN_SCHED_TIMES (new_insn) = sched_times;
+    }
+  else
+    INSN_SCHED_TIMES (new_insn) = 0;
+
   bitmap_set_bit (current_copies, INSN_UID (new_insn));

   return new_insn;

Reply via email to