loop.c fix

Joern Rennecke amylaar@cygnus.co.uk
Sun Feb 28 18:15:00 GMT 1999


> Noticing this restores the ability of loop/unroll to determine the iteration
> code for many loops that was lost with Joern's bugfix on the 4th.
> 
> 	* loop.c (strength_reduce): Clear not_every_iteration when 
> 	passing the NOTE_INSN_LOOP_CONT note.

The -funroll-loops bootstrap for by latest strength reduction patch
found a problem with this handling of NOTE_INSN_LOOP_CONT notes:
Unroll will duplicate these notes along with the loop body, so that we can
find a premature note.  There is already a check not to duplicate VTOP notes,
so it seems logical to extend it to CONT notes.

In an hour I'll know if this patch works.

Sat Feb 27 03:16:33 1999  J"orn Rennecke <amylaar@cygnus.co.uk>

	* unroll.c (copy_loop_body): Don't make extra copies of
	NOTE_INSN_LOOP_CONT notes.

*** unroll.c-19990224	Wed Feb 24 20:08:39 1999
--- unroll.c	Sat Feb 27 03:13:22 1999
*************** copy_loop_body (copy_start, copy_end, ma
*** 2149,2159 ****
  	  break;
  
  	case NOTE:
! 	  /* VTOP notes are valid only before the loop exit test.  If placed
! 	     anywhere else, loop may generate bad code.  */
  
  	  if (NOTE_LINE_NUMBER (insn) != NOTE_INSN_DELETED
! 	      && (NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_VTOP
  		  || (last_iteration && unroll_type != UNROLL_COMPLETELY)))
  	    copy = emit_note (NOTE_SOURCE_FILE (insn),
  			      NOTE_LINE_NUMBER (insn));
--- 2149,2160 ----
  	  break;
  
  	case NOTE:
! 	  /* VTOP and CONT notes are valid only before the loop exit test.
! 	     If placed anywhere else, loop may generate bad code.  */
  
  	  if (NOTE_LINE_NUMBER (insn) != NOTE_INSN_DELETED
! 	      && ((NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_VTOP
! 		   && NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_CONT)
  		  || (last_iteration && unroll_type != UNROLL_COMPLETELY)))
  	    copy = emit_note (NOTE_SOURCE_FILE (insn),
  			      NOTE_LINE_NUMBER (insn));



More information about the Gcc-patches mailing list