🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Devor Tevi Wed, 08 Apr 1992 15:01
Another scheduler bug
#340
Author: Devor Tevi
Date: Wed, 08 Apr 1992 15:01
95 lines
3308 bytes
Bug in the scheduler when compiling cp-expc.c/make_temporary_for_reference()
using -O -fschedule-insns

I am using the sources from 25-March-95 configured for i386v4. I
have added functional units.

The bug is related to the case of CC0, as was the previous bug I sent.

For the following set of insns in one of the basic blocks insn 230
is scheduled twice. This results in the linked list of rtl becoming
circular.

(insn 230 228 231 (set (cc0)
       (compare (mem:SI (symbol_ref:SI ("current_binding_level")))
           (mem:SI (symbol_ref:SI ("global_binding_level"))))) -1 (nil)
   (nil))

(note 231 230 232 "" NOTE_INSN_DELETED)

(note 232 231 233 "" NOTE_INSN_DELETED)

(insn 233 232 234 (set (reg:QI 43)
       (eq:QI (cc0)
           (const_int 0))) 139 {seq} (nil)
   (nil))


This happens as follows:

There is no LOG LINK dependence set up between insn 233 and insn 230.

insn 233 is marked as SCHED_GROUP_P.

Now since there is no dependency from 233 to 230 the scheduler decides
to schedule 230 before it ever reaches 233 on it's backward scan. So
by the time we reach 233, 230 has been scheduled (the scheduler decided
it was profitable to do so and the INSN_REF_COUNT(insn 230) became 0).

Now when we reach 233 insn 230 is scheduled again because insn 233
is  SCHED_GROUP_P.

I added a dependency from 233 to 230 but this was not enough since then
when launch_links() was called for insn 233, insn 230 was placed in the
insn_queue. But insn 230 was also immediately scheduled because insn 233 
is SCHED_GROUP_P, and it wasn't removed from the queue. This caused q_size 
to be != 0 at the end of the block - which triggers an abort.

So I also added some code to launch_links() so that insn 230 will not
go into the queue.

My suggested fix for this follows:

Regards,
Tevi.

tevi@iilcad.intel.com
972-4-355675

1217c1217
< 	rtx link;
---
> 	rtx link,prev;
1228c1228,1231
< 	for (link = LOG_LINKS (PREV_INSN (insn)); link; link = XEXP (link, 1))
---
> 	prev = PREV_INSN(insn);
> 	while(GET_CODE(prev)==NOTE)
> 	  prev = PREV_INSN(prev);
> 	for (link = LOG_LINKS (prev); link; link = XEXP (link, 1))
1230a1234,1238
> 	/* add dependence between insn and prev otherwise prev may
> 	   be scheduled before insn and then rescheduled again as
> 	   part of insn's SHED_GROUP_P */
> 	add_dependence(insn,prev,0);
> 
1815a1824
>   rtx prev_rtl = NULL;
1816a1826,1834
>   if(SCHED_GROUP_P(insn))
>     { /* see handling of prev_rtl==prev below */
>       prev_rtl = PREV_INSN(insn);
>       while(GET_CODE(prev_rtl)==NOTE)
> 	{
> 	  prev_rtl = PREV_INSN(prev_rtl);
> 	}
>     }
> 
1829a1848,1854
>       if(prev_rtl==prev)
> 	{ /* this means that prev is part of the group of insns that
> 	     will be scheduled along with insn and therefore should
> 	     not go through the insn_queue or ready list */
> 	  ; /* nothing
> 	}
>       else
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads