public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* RE: infinite loop in find_rgns
@ 2003-04-02 12:23 Sanjiv Kumar Gupta, Noida
  2003-04-02 20:14 ` Richard Henderson
  0 siblings, 1 reply; 4+ messages in thread
From: Sanjiv Kumar Gupta, Noida @ 2003-04-02 12:23 UTC (permalink / raw)
  To: gcc

>In my case , current_edge is 0 at start. This is running in 
>infinite loop then.

I got the above problem while trying to enable the first
scheduling pass for SH4.

The problem is, find_rgns() doesn't work in case of CFG not
having a basic block whose index is 0. In case of SH4,
the CFG starts with BB1 instead of BB0 for find_rgns 
(optimize_mode_switching converts the CFG in this way). So the 
follwing assignment is probably not correct in this case.

Line 628 sched-rgn.c
	...,current_edge = out_edges[0];

Since the array out_edges is xcalloced, it gives current_edge as
0 even if the BB0 is not present in the CFG. And since the current_edge
is 0 at start, it runs into infinite loop.

One solution to correct this is to check the value
of current_edge till you get a valid value (0 is an illegal
 value I guess). 
Looking for your suggestions while I am experimenting this.

--Sanjiv

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

* Re: infinite loop in find_rgns
  2003-04-02 12:23 infinite loop in find_rgns Sanjiv Kumar Gupta, Noida
@ 2003-04-02 20:14 ` Richard Henderson
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2003-04-02 20:14 UTC (permalink / raw)
  To: Sanjiv Kumar Gupta, Noida; +Cc: gcc

On Wed, Apr 02, 2003 at 02:54:56PM +0530, Sanjiv Kumar Gupta, Noida wrote:
> Looking for your suggestions while I am experimenting this.

compact_blocks.


r~

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

* RE: infinite loop in find_rgns
@ 2003-04-03  9:57 Sanjiv Kumar Gupta, Noida
  0 siblings, 0 replies; 4+ messages in thread
From: Sanjiv Kumar Gupta, Noida @ 2003-04-03  9:57 UTC (permalink / raw)
  To: Richard Henderson; +Cc: gcc

>compact_blocks.


>r~
Thanks, It's a more clean solution and it works for me.

--Sanjiv

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

* infinite loop in find_rgns
@ 2003-03-31 16:15 Sanjiv Kumar Gupta, Noida
  0 siblings, 0 replies; 4+ messages in thread
From: Sanjiv Kumar Gupta, Noida @ 2003-03-31 16:15 UTC (permalink / raw)
  To: gcc

Curious to know how does the following piece of code
in find_rgns works.

 ...
 passed = sbitmap_alloc (nr_edges);
  sbitmap_zero (passed);
    
  .....
    
  /* DFS traversal to find inner loops in the cfg.  */
    
  sp = -1;
  while (1)
    {
      if (current_edge == 0 || TEST_BIT (passed, current_edge))

    	{
    	  /* We have reached a leaf node or a node that was already
    	     processed.  Pop edges off the stack until we find
    	     an edge that has not yet been processed.  */
    	  while (sp >= 0
    		 && (current_edge == 0 || TEST_BIT (passed, current_edge)))
    	    {
    	      /* Pop entry off the stack.  */
    	      current_edge = stack[sp--];
    	      ....
    	    }
    
    	  /* See if have finished the DFS tree traversal.  */
    	  if (sp < 0 && TEST_BIT (passed, current_edge))
    	    break;
    
    	  /* Nope, continue the traversal with the popped node.  */
    	  continue;
    	}

In my case , current_edge is 0 at start. This is running in 
infinite loop then.

--Sanjiv

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

end of thread, other threads:[~2003-04-03  8:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-02 12:23 infinite loop in find_rgns Sanjiv Kumar Gupta, Noida
2003-04-02 20:14 ` Richard Henderson
  -- strict thread matches above, loose matches on Subject: below --
2003-04-03  9:57 Sanjiv Kumar Gupta, Noida
2003-03-31 16:15 Sanjiv Kumar Gupta, Noida

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