This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

loop unrolling fix


Hi,
we abort on following testcase:

void foo (void *) __attribute__ ((noreturn));

void
bar (void *x)
{
  if (__builtin_setjmp (x))
    return;
  foo (x);
}

As we attempt to peel loop constructed from setjmp and foo.  Fixed by
checking can_duplicate_loop_p.  Anyway there is something wrong:

static void
loop_redirect_edge (e, dest)
     edge e;
     basic_block dest;
{
  if (e->dest == dest)
    return;

  if (!e->src->succ->succ_next)
    {
      /* Code of cfglayout should be able to handle this, and redirection
         is happier.  */
      e->flags |= EDGE_FALLTHRU;
    }

    cfg_layout_redirect_edge (e, dest);
  }

(modulo wrong formating) the portion marking edge FALLTHRU for no purpose is wrong.
I am just testing patch that removes it.  Zdenek, why this get in?
It looks like you are getting some uncodntional jumps in the insn stream, but
when cfg-layout is active we should not ahve any.

Honza

Thu Mar 28 18:40:41 CET 2002  Jan Hubicka  <jh@suse.cz>
	* unroll-new.c (peel_loop): Check can_duplicate_loop_p.

Index: unroll-new.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/Attic/unroll-new.c,v
retrieving revision 1.1.2.3
diff -c -3 -p -r1.1.2.3 unroll-new.c
*** unroll-new.c	2002/03/27 22:25:49	1.1.2.3
--- unroll-new.c	2002/03/28 17:40:39
*************** peel_loop (loops, loop, will_unroll)
*** 687,692 ****
--- 687,699 ----
    int niter;
    struct loop_desc desc;
  
+   if (!can_duplicate_loop_p (loop))
+     {
+       if (rtl_dump_file)
+ 	fprintf (rtl_dump_file, ";; Not peeling loop, can't duplicate\n");
+       return 0;
+     }
+ 
    /* Do not peel cold areas.  */
    if (!maybe_hot_bb_p (loop->header))
      {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]