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]

[autovect] Fix testsuite/gcc.dg/tree-ssa/20041110-1.c


This patch simplifies the use of compute_data_dependences_for_loop by
removing its nb_loops parameter.

Bootstrapped and tested on amd64-linux, fixes gcc.dg/tree-ssa/20041110-1.c.
Committed to autovect-branch.

	* tree-data-ref.c: Remove some declarations of static functions.
	(compute_data_dependences_for_loop): Don't pass nb_loops as a 
	parameter, deduce it from the computation of the loop_nest.
	(analyze_all_data_dependences): Update uses of
	compute_data_dependences_for_loop.
	* tree-data-ref.h (compute_data_dependences_for_loop): Update
	declaration.
	* tree-loop-linear.c (linear_transform_loops): Update uses of
	compute_data_dependences_for_loop.  The size of the matrices is
	computed as loop_nest->level.
	* tree-vect-analyze.c (vect_analyze_data_refs): Update uses of
	compute_data_dependences_for_loop.
	* tree-vectorizer.c (loops_num): Make it static.
	* tree-vectorizer.h (loops_num): Remove the extern declaration.

Index: tree-data-ref.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-data-ref.c,v
retrieving revision 2.15.4.19
diff -d -u -p -r2.15.4.19 tree-data-ref.c
--- tree-data-ref.c	19 Apr 2005 10:47:27 -0000	2.15.4.19
+++ tree-data-ref.c	19 Apr 2005 15:40:39 -0000
@@ -122,21 +122,11 @@ static struct datadep_stats
   int num_miv_unimplemented;
 } dependence_stats;
 
-static bool analyze_offset_expr (tree, struct loop *, tree, 
-				 tree *, tree *, tree *);
-static tree strip_conversion (tree);
 static tree object_analysis (tree, tree, bool, tree, struct data_reference **, 
 			     tree *, tree *, tree *, bool *, tree *);
-static tree address_analysis (tree, tree, bool, tree, struct data_reference *, 
-			      tree *, tree *, tree *, bool *);
 static struct data_reference * init_data_ref (tree, tree, tree, tree, bool, 
 				      tree, tree, tree, tree, bool, tree,
 				      struct ptr_info_def *);
-static struct data_reference * analyze_indirect_ref (tree, tree, bool);
-static struct data_reference * create_data_ref (tree, tree, bool, tree);
-static bool base_addr_differ_p (struct data_reference *,
-				struct data_reference *drb, bool *);
-static void analyze_offset (tree, tree *, tree *);
   
 /* This is the simplest data dependence test: determines whether the
    data references A and B access the same array/region.  Returns
@@ -3705,17 +3695,20 @@ find_data_references_in_loop (struct loo
    COMPUTE_SELF_AND_READ_READ_DEPENDENCES is TRUE.  */
 
 void
-compute_data_dependences_for_loop (unsigned nb_loops, 
-				   struct loop *loop,
+compute_data_dependences_for_loop (struct loop *loop,
 				   tree alignment,
 				   bool compute_self_and_read_read_dependences,
 				   varray_type *datarefs,
 				   varray_type *dependence_relations)
 {
-  unsigned int i;
+  unsigned int i, nb_loops;
   varray_type allrelations;
   struct loop *loop_nest = loop;
 
+  while (loop_nest && loop_nest->outer && loop_nest->outer->outer)
+    loop_nest = loop_nest->outer;
+  nb_loops = loop_nest->level;
+
   memset (&dependence_stats, 0, sizeof (dependence_stats));
 
   /* If one of the data references is not computable, give up without
@@ -3738,9 +3731,6 @@ compute_data_dependences_for_loop (unsig
   compute_all_dependences (*datarefs, &allrelations,
                            compute_self_and_read_read_dependences);
 
-  while (loop_nest && loop_nest->outer && loop_nest->outer->outer)
-    loop_nest = loop_nest->outer;
-
   for (i = 0; i < VARRAY_ACTIVE_SIZE (allrelations); i++)
     {
       struct data_dependence_relation *ddr;
@@ -3836,7 +3826,7 @@ analyze_all_data_dependences (struct loo
 			   "dependence_relations");
 
   /* Compute DDs on the whole function.  */
-  compute_data_dependences_for_loop (loops->num, loops->parray[0], NULL_TREE,
+  compute_data_dependences_for_loop (loops->parray[0], NULL_TREE,
 				     false, &datarefs, &dependence_relations);
 
   if (dump_file)
Index: tree-data-ref.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-data-ref.h,v
retrieving revision 2.5.4.7
diff -d -u -p -r2.5.4.7 tree-data-ref.h
--- tree-data-ref.h	19 Apr 2005 10:47:28 -0000	2.5.4.7
+++ tree-data-ref.h	19 Apr 2005 15:40:39 -0000
@@ -203,8 +203,7 @@ extern bool build_classic_dist_vector (s
 				       int);
 
 extern void analyze_all_data_dependences (struct loops *);
-extern void compute_data_dependences_for_loop (unsigned, struct loop *, tree, 
-					       bool, 
+extern void compute_data_dependences_for_loop (struct loop *, tree, bool,
 					       varray_type *, varray_type *);
 extern struct data_reference *analyze_array (tree, tree, bool);
 
Index: tree-loop-linear.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-loop-linear.c,v
retrieving revision 2.4.2.5
diff -d -u -p -r2.4.2.5 tree-loop-linear.c
--- tree-loop-linear.c	19 Apr 2005 10:47:28 -0000	2.4.2.5
+++ tree-loop-linear.c	19 Apr 2005 15:40:39 -0000
@@ -246,7 +246,7 @@ linear_transform_loops (struct loops *lo
   
   for (i = 1; i < loops->num; i++)
     {
-      unsigned int depth = 0;
+      unsigned int depth;
       varray_type datarefs;
       varray_type dependence_relations;
       struct loop *loop_nest = loops->parray[i];
@@ -273,17 +273,13 @@ linear_transform_loops (struct loops *lo
            } */
       if (!loop_nest || !loop_nest->inner)
 	continue;
-      depth = 1;
       for (temp = loop_nest->inner; temp; temp = temp->inner)
-	{
-	  /* If we have a sibling loop or multiple exit edges, jump ship.  */
-	  if (temp->next || !temp->single_exit)
-	    {
-	      problem = true;
-	      break;
-	    }
-	  depth ++;
-	}
+	/* If we have a sibling loop or multiple exit edges, jump ship.  */
+	if (temp->next || !temp->single_exit)
+	  {
+	    problem = true;
+	    break;
+	  }
       if (problem)
 	continue;
 
@@ -293,8 +289,7 @@ linear_transform_loops (struct loops *lo
       VARRAY_GENERIC_PTR_INIT (dependence_relations, 10,
 			       "dependence_relations");
       
-  
-      compute_data_dependences_for_loop (depth, loop_nest, NULL_TREE, true, 
+      compute_data_dependences_for_loop (loop_nest, NULL_TREE, true,
 					 &datarefs, &dependence_relations);
       if (dump_file && (dump_flags & TDF_DETAILS))
 	{
@@ -320,6 +315,7 @@ linear_transform_loops (struct loops *lo
 	  fprintf (dump_file, "\n\n");
 	}
       /* Build the transformation matrix.  */
+      depth = loop_nest->level;
       trans = lambda_trans_matrix_new (depth, depth);
       lambda_matrix_id (LTM_MATRIX (trans), depth);
 
Index: tree-vect-analyze.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-vect-analyze.c,v
retrieving revision 2.4.4.12
diff -d -u -p -r2.4.4.12 tree-vect-analyze.c
--- tree-vect-analyze.c	19 Apr 2005 10:47:28 -0000	2.4.4.12
+++ tree-vect-analyze.c	19 Apr 2005 15:40:39 -0000
@@ -1314,7 +1314,7 @@ vect_analyze_data_refs (loop_vec_info lo
   if (vect_print_dump_info (REPORT_DETAILS, UNKNOWN_LOC))
     fprintf (vect_dump, "=== vect_analyze_data_refs ===");
 
-  compute_data_dependences_for_loop (loops_num, loop,
+  compute_data_dependences_for_loop (loop,
 				     ssize_int (UNITS_PER_SIMD_WORD), false,
 				     &(LOOP_VINFO_DATAREFS (loop_vinfo)),
 				     &(LOOP_VINFO_DDRS (loop_vinfo)));
Index: tree-vectorizer.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-vectorizer.c,v
retrieving revision 2.25.2.25
diff -d -u -p -r2.25.2.25 tree-vectorizer.c
--- tree-vectorizer.c	10 Apr 2005 21:10:07 -0000	2.25.2.25
+++ tree-vectorizer.c	19 Apr 2005 15:40:39 -0000
@@ -178,7 +178,7 @@ FILE *vect_dump;
    to mark that it's uninitialized.  */
 enum verbosity_levels vect_verbosity_level = MAX_VERBOSITY_LEVEL;
 
-unsigned int loops_num;
+static unsigned int loops_num;
 
 
 /*************************************************************************
Index: tree-vectorizer.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-vectorizer.h,v
retrieving revision 2.7.2.16
diff -d -u -p -r2.7.2.16 tree-vectorizer.h
--- tree-vectorizer.h	10 Apr 2005 21:10:09 -0000	2.7.2.16
+++ tree-vectorizer.h	19 Apr 2005 15:40:39 -0000
@@ -296,7 +296,6 @@ known_alignment_for_access_p (struct dat
 /* vect_dump will be set to stderr or dump_file if exist.  */
 extern FILE *vect_dump;
 extern enum verbosity_levels vect_verbosity_level;
-extern unsigned int loops_num;
 
 /*-----------------------------------------------------------------*/
 /* Function prototypes.                                            */



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