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]

[PATCH] Fix PR59038


This fixes PR59038 by reverting the wrong fix for PR58955 and instead
installing the correct fix (fingers crossing).

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2013-11-07  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/59038
	PR tree-optimization/58955
	* tree-loop-distribution.c (pg_add_dependence_edges): Revert
	previous change.  Handle known dependences correctly.

	* gcc.dg/torture/pr59038.c: New testcase.

Index: gcc/tree-loop-distribution.c
===================================================================
*** gcc/tree-loop-distribution.c	(revision 204506)
--- gcc/tree-loop-distribution.c	(working copy)
*************** pg_add_dependence_edges (struct graph *r
*** 1324,1330 ****
    for (int ii = 0; drs1.iterate (ii, &dr1); ++ii)
      for (int jj = 0; drs2.iterate (jj, &dr2); ++jj)
        {
! 	int this_dir = -1;
  	ddr_p ddr;
  	/* Re-shuffle data-refs to be in dominator order.  */
  	if (rdg_vertex_for_stmt (rdg, DR_STMT (dr1))
--- 1324,1330 ----
    for (int ii = 0; drs1.iterate (ii, &dr1); ++ii)
      for (int jj = 0; drs2.iterate (jj, &dr2); ++jj)
        {
! 	int this_dir = 1;
  	ddr_p ddr;
  	/* Re-shuffle data-refs to be in dominator order.  */
  	if (rdg_vertex_for_stmt (rdg, DR_STMT (dr1))
*************** pg_add_dependence_edges (struct graph *r
*** 1350,1357 ****
  	      }
  	    /* Known dependences can still be unordered througout the
  	       iteration space, see gcc.dg/tree-ssa/ldist-16.c.  */
! 	    if (DDR_NUM_DIST_VECTS (ddr) == 0)
  	      this_dir = 2;
  	  }
  	else
  	  this_dir = 0;
--- 1350,1366 ----
  	      }
  	    /* Known dependences can still be unordered througout the
  	       iteration space, see gcc.dg/tree-ssa/ldist-16.c.  */
! 	    if (DDR_NUM_DIST_VECTS (ddr) != 1)
  	      this_dir = 2;
+ 	    /* If the overlap is exact preserve stmt order.  */
+ 	    else if (lambda_vector_zerop (DDR_DIST_VECT (ddr, 0), 1))
+ 	      ;
+ 	    else
+ 	      {
+ 		/* Else as the distance vector is lexicographic positive
+ 		   swap the dependence direction.  */
+ 		this_dir = -this_dir;
+ 	      }
  	  }
  	else
  	  this_dir = 0;
Index: gcc/testsuite/gcc.dg/torture/pr59038.c
===================================================================
*** gcc/testsuite/gcc.dg/torture/pr59038.c	(revision 0)
--- gcc/testsuite/gcc.dg/torture/pr59038.c	(working copy)
***************
*** 0 ****
--- 1,25 ----
+ /* { dg-do run } */
+ 
+ extern void abort (void);
+ 
+ unsigned char first_ones_8bit[256];
+ unsigned char connected_passed[256];
+ 
+ int
+ main ()
+ {
+   int i, j;
+   for (i=0;i<256;i++){
+       connected_passed[i]=0;
+       first_ones_8bit[i]=0;
+       for (j=7;j>0;j--){
+ 	  if ((i & (3<<(7-j))) == (3<<(7-j))){
+ 	      connected_passed[i]=j;
+ 	      break;
+ 	  }
+       }
+   }
+   if (connected_passed[3] != 7)
+     abort ();
+   return 0;
+ }


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