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]

Re: [patch]Autovectorization loop versioning for data alignment


> On Sat, Jun 18, 2005 at 06:29:32PM -0500, Keith Besaw wrote:
> > I guess we wait for a response from Jan Hubicka as to when/if the 
> > remaining ICE is likely to be fixed.
> 
> The ICEs on mainline have been fixed.  If your patch introduces
> another, it means you're missing some code.

Hi,
The problem is that duplicate_loop_to_header_edge is setting
copy_numbers (now aux pointers) for all copies of loop.  Later there is
a loop clearing these numbers I tought to kill all them but in reality
it is just clearing out the original copy of loop (not 100% sure why).
The copy numbers are later used by RTL level unrolling code.  It seems
best to avoid setting the aux pointers for other passes than those
consuming them as done by this patch.

Bootstrapped/regtested i686-pc-gnu-linux, now gfortran testsuite has no
unexpected failures for me.  I apologize for the problems I
caused.  It was caused by fact that I happent to have two patches with
same name, tested one and submitted/comitted the other....

Honza

2005-06-19  Jan Hubicka  <jh@suse.cz>
	* cfgloop.h (DLTHE_RECORD_COPY_NUMBER): New flag.
	* cfgloopmanip.c (duplicate_loop_to_header_edge): Set aux flags only
	when asked for.
	* loop-unroll.c (peel_loop_completely, unroll_loop_constant_iterations,
	unroll_loop_runtime_iterations, peel_loop_simple, unroll_loop_stupid):
	Update call of duplicate_loop_to_header_edge.
	(apply_opt_in_copies): Clear out aux pointers.

Index: cfgloop.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgloop.h,v
retrieving revision 1.46
diff -c -3 -p -r1.46 cfgloop.h
*** cfgloop.h	2 Jun 2005 10:19:12 -0000	1.46
--- cfgloop.h	19 Jun 2005 14:47:09 -0000
*************** extern bool can_duplicate_loop_p (struct
*** 296,301 ****
--- 296,303 ----
  
  #define DLTHE_FLAG_UPDATE_FREQ	1	/* Update frequencies in
  					   duplicate_loop_to_header_edge.  */
+ #define DLTHE_RECORD_COPY_NUMBER 2	/* Record copy number in the aux
+ 					   field of newly create BB.  */
  
  extern struct loop * duplicate_loop (struct loops *, struct loop *,
  				     struct loop *);
Index: cfgloopmanip.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgloopmanip.c,v
retrieving revision 1.48
diff -c -3 -p -r1.48 cfgloopmanip.c
*** cfgloopmanip.c	15 Jun 2005 23:05:19 -0000	1.48
--- cfgloopmanip.c	19 Jun 2005 14:47:09 -0000
*************** duplicate_loop_to_header_edge (struct lo
*** 982,992 ****
        /* Copy bbs.  */
        copy_bbs (bbs, n, new_bbs, spec_edges, 2, new_spec_edges, loop);
  
!       for (i = 0; i < n; i++)
! 	{
! 	  gcc_assert (!new_bbs[i]->aux);
! 	  new_bbs[i]->aux = (void *)(size_t)(j + 1);
! 	}
  
        /* Note whether the blocks and edges belong to an irreducible loop.  */
        if (add_irreducible_flag)
--- 982,993 ----
        /* Copy bbs.  */
        copy_bbs (bbs, n, new_bbs, spec_edges, 2, new_spec_edges, loop);
  
!       if (flags & DLTHE_RECORD_COPY_NUMBER)
! 	for (i = 0; i < n; i++)
! 	  {
! 	    gcc_assert (!new_bbs[i]->aux);
! 	    new_bbs[i]->aux = (void *)(size_t)(j + 1);
! 	  }
  
        /* Note whether the blocks and edges belong to an irreducible loop.  */
        if (add_irreducible_flag)
Index: loop-unroll.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/loop-unroll.c,v
retrieving revision 1.34
diff -c -3 -p -r1.34 loop-unroll.c
*** loop-unroll.c	15 Jun 2005 23:05:22 -0000	1.34
--- loop-unroll.c	19 Jun 2005 14:47:09 -0000
*************** peel_loop_completely (struct loops *loop
*** 519,525 ****
  					  loops, npeel,
  					  wont_exit, desc->out_edge,
  					  remove_edges, &n_remove_edges,
! 					  DLTHE_FLAG_UPDATE_FREQ);
        gcc_assert (ok);
  
        free (wont_exit);
--- 519,527 ----
  					  loops, npeel,
  					  wont_exit, desc->out_edge,
  					  remove_edges, &n_remove_edges,
! 					  DLTHE_FLAG_UPDATE_FREQ
! 					  | (opt_info
! 					     ? DLTHE_RECORD_COPY_NUMBER : 0));
        gcc_assert (ok);
  
        free (wont_exit);
*************** unroll_loop_constant_iterations (struct 
*** 717,723 ****
  					      loops, exit_mod,
  					      wont_exit, desc->out_edge,
  					      remove_edges, &n_remove_edges,
! 					      DLTHE_FLAG_UPDATE_FREQ);
  	  gcc_assert (ok);
  
            if (opt_info && exit_mod > 1)
--- 719,728 ----
  					      loops, exit_mod,
  					      wont_exit, desc->out_edge,
  					      remove_edges, &n_remove_edges,
! 					      DLTHE_FLAG_UPDATE_FREQ
! 					      | (opt_info && exit_mod > 1
! 						 ? DLTHE_RECORD_COPY_NUMBER
! 						   : 0));
  	  gcc_assert (ok);
  
            if (opt_info && exit_mod > 1)
*************** unroll_loop_constant_iterations (struct 
*** 753,759 ****
  					      loops, exit_mod + 1,
  					      wont_exit, desc->out_edge,
  					      remove_edges, &n_remove_edges,
! 					      DLTHE_FLAG_UPDATE_FREQ);
  	  gcc_assert (ok);
   
            if (opt_info && exit_mod > 0)
--- 758,767 ----
  					      loops, exit_mod + 1,
  					      wont_exit, desc->out_edge,
  					      remove_edges, &n_remove_edges,
! 					      DLTHE_FLAG_UPDATE_FREQ
! 					      | (opt_info && exit_mod > 0
! 						 ? DLTHE_RECORD_COPY_NUMBER
! 						   : 0));
  	  gcc_assert (ok);
   
            if (opt_info && exit_mod > 0)
*************** unroll_loop_constant_iterations (struct 
*** 777,783 ****
  				      loops, max_unroll,
  				      wont_exit, desc->out_edge,
  				      remove_edges, &n_remove_edges,
! 				      DLTHE_FLAG_UPDATE_FREQ);
    gcc_assert (ok);
  
    if (opt_info)
--- 785,794 ----
  				      loops, max_unroll,
  				      wont_exit, desc->out_edge,
  				      remove_edges, &n_remove_edges,
! 				      DLTHE_FLAG_UPDATE_FREQ
! 				      | (opt_info
! 					 ? DLTHE_RECORD_COPY_NUMBER
! 					   : 0));
    gcc_assert (ok);
  
    if (opt_info)
*************** unroll_loop_runtime_iterations (struct l
*** 1097,1103 ****
  				      loops, max_unroll,
  				      wont_exit, desc->out_edge,
  				      remove_edges, &n_remove_edges,
! 				      DLTHE_FLAG_UPDATE_FREQ);
    gcc_assert (ok);
    
    if (opt_info)
--- 1108,1117 ----
  				      loops, max_unroll,
  				      wont_exit, desc->out_edge,
  				      remove_edges, &n_remove_edges,
! 				      DLTHE_FLAG_UPDATE_FREQ
! 				      | (opt_info
! 					 ? DLTHE_RECORD_COPY_NUMBER
! 					   : 0));
    gcc_assert (ok);
    
    if (opt_info)
*************** peel_loop_simple (struct loops *loops, s
*** 1274,1280 ****
    ok = duplicate_loop_to_header_edge (loop, loop_preheader_edge (loop),
  				      loops, npeel, wont_exit,
  				      NULL, NULL,
! 				      NULL, DLTHE_FLAG_UPDATE_FREQ);
    gcc_assert (ok);
  
    free (wont_exit);
--- 1288,1297 ----
    ok = duplicate_loop_to_header_edge (loop, loop_preheader_edge (loop),
  				      loops, npeel, wont_exit,
  				      NULL, NULL,
! 				      NULL, DLTHE_FLAG_UPDATE_FREQ
! 				      | (opt_info
! 					 ? DLTHE_RECORD_COPY_NUMBER
! 					   : 0));
    gcc_assert (ok);
  
    free (wont_exit);
*************** unroll_loop_stupid (struct loops *loops,
*** 1422,1428 ****
    ok = duplicate_loop_to_header_edge (loop, loop_latch_edge (loop),
  				      loops, nunroll, wont_exit,
  				      NULL, NULL, NULL,
! 				      DLTHE_FLAG_UPDATE_FREQ);
    gcc_assert (ok);
    
    if (opt_info)
--- 1439,1448 ----
    ok = duplicate_loop_to_header_edge (loop, loop_latch_edge (loop),
  				      loops, nunroll, wont_exit,
  				      NULL, NULL, NULL,
! 				      DLTHE_FLAG_UPDATE_FREQ
! 				      | (opt_info
! 					 ? DLTHE_RECORD_COPY_NUMBER
! 					   : 0));
    gcc_assert (ok);
    
    if (opt_info)
*************** apply_opt_in_copies (struct opt_info *op
*** 2064,2069 ****
--- 2084,2090 ----
  	 duplicate_loop_to_header_edge.  */
        delta = determine_split_iv_delta ((size_t)bb->aux, n_copies,
  					unrolling);
+       bb->aux = 0;
        orig_insn = BB_HEAD (orig_bb);
        for (insn = BB_HEAD (bb); insn != NEXT_INSN (BB_END (bb)); insn = next)
          {


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