unroller bug

Jeffrey A Law law@cygnus.com
Sat Jan 2 17:42:00 GMT 1999

Any chance you could take a look at this Michael?  You've been in the unrolling
code recently so you could probably come up to speed more quickly than I could.

Build a cross cc1 for hppa1.1-hp-hpux10.20 from the current CVS sources.  Then
compile the attached testcase with -O2 -funroll-loops to make the compiler

I believe the problem is the unroller is creating non-canonical rtl.  In
particular note from the .loop dump:

(jump_insn 107 105 109 (set (pc)
        (if_then_else (ge (const_int 0)
                (reg/v:SI 96))
            (label_ref 136)
            (pc))) -1 (nil)

The constant is supposed to appear as the second source operand to the
compare.  I suspect you probably need reverse the args and the comparison.

It may be the case that we're now unrolling a class of loops that we did not
before and as a result we're getting this non-canonical rtl.

typedef union rtunion_def
  struct rtx_def *rtx;
  struct rtvec_def *rtvec;
} rtunion;
typedef struct rtx_def
  unsigned short code;
  int mode : 8;
  unsigned int jump : 1;
  unsigned int call : 1;
  unsigned int unchanging : 1;
  unsigned int volatil : 1;
  unsigned int in_struct : 1;
  unsigned int used : 1;
  unsigned integrated : 1;
  unsigned frame_related : 1;
  rtunion fld[1];
} *rtx;
typedef struct rtvec_def{
  int num_elem;		 
  rtunion elem[1];
} *rtvec;
read_rtx ()
  register int i, j, list_counter;
  register char *format_ptr;
  char tmp_char[256];
  rtx return_rtx;
  register int c;
  int tmp_int;
  int  tmp_wide;
  struct rtx_list
      struct rtx_list *next;
      rtx value;		 
	  register struct rtx_list *next_rtx, *rtx_list_link;
	  struct rtx_list *list_rtx = ((void *)0) ;
	  while ((c = read_skip_spaces ()) && c != ']')
	      for (j = 0; j < list_counter; j++,
		   next_rtx = next_rtx->next)
		(( return_rtx )->fld[  i ].rtvec->elem[  j ].rtx)  = next_rtx->value;

More information about the Gcc-bugs mailing list