This is the mail archive of the gcc-bugs@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]

more ia32 bugs (unrolling)


Ok, here is the next one:

void
rescan () {
  if (fee())
    {
      while (1) {
      }
    }
 
  {
    int newlines = foo();
    while (0 < newlines--)
      bar();
  }
}

is is derived from cccp.c during a bootstrap.  In unroll.c:

  /* If there is a more than a single jump to the top of the loop
     we cannot (easily) determine the iteration count.  */
=>if (LABEL_NUSES (JUMP_LABEL (last_loop_insn)) > 1)
    {
      if (loop_dump_stream)
        fprintf (loop_dump_stream,
                 "Loop iterations: Loop has multiple back edges.\n");
      return 0;
    }

JUMP_LABEL comes up 0.  :-( And we die for it.  In the old compiler,
no such code.  I checked the source out, and this is new code:

revision 1.43
date: 1999/01/15 10:05:56;  author: law;  state: Exp;  lines: +26 -5
8
        * unroll.c (loop_iterations): Return 0 if the last loop insn
        is not a jump insn or if the loop has multiple back edges.

I think there is a bug in that work.  Maybe the below patch is the
right fix, maybe not.  It does make the testcase work.

      * unroll.c (loop_iterations): Don't assume that JUMP_LABEL is set.

Doing diffs in unroll.c.~1~:
*** unroll.c.~1~	Fri Jun 18 15:03:49 1999
--- unroll.c	Tue Jun 22 18:51:14 1999
*************** loop_iterations (loop_start, loop_end, l
*** 3669,3675 ****
  
    /* If there is a more than a single jump to the top of the loop
       we cannot (easily) determine the iteration count.  */
!   if (LABEL_NUSES (JUMP_LABEL (last_loop_insn)) > 1)
      {
        if (loop_dump_stream)
  	fprintf (loop_dump_stream,
--- 3669,3676 ----
  
    /* If there is a more than a single jump to the top of the loop
       we cannot (easily) determine the iteration count.  */
!   if (JUMP_LABEL (last_loop_insn) == 0
!       || LABEL_NUSES (JUMP_LABEL (last_loop_insn)) > 1)
      {
        if (loop_dump_stream)
  	fprintf (loop_dump_stream,
--------------


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