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] [committed] Improve one of the data dependence test


Tested on i686.  Applied to autovect-branch.

	* tree-chrec.c (eq_evolutions_p): New.
	* tree-chrec.h (eq_evolutions_p): Declared.
	* tree-data-ref.c (analyze_overlapping_iterations): Use eq_evolutions_p.

Index: tree-chrec.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-chrec.c,v
retrieving revision 2.11.4.2
diff -d -u -p -r2.11.4.2 tree-chrec.c
--- tree-chrec.c	15 Dec 2004 18:26:15 -0000	2.11.4.2
+++ tree-chrec.c	19 Dec 2004 14:25:50 -0000
@@ -1028,3 +1028,32 @@ chrec_type (tree chrec)
   
   return TREE_TYPE (chrec);
 }
+
+/* Returns true when CHREC0 == CHREC1.  */
+
+bool 
+eq_evolutions_p (tree chrec0, 
+		 tree chrec1)
+{
+  if (chrec0 == NULL_TREE
+      || chrec1 == NULL_TREE
+      || TREE_CODE (chrec0) != TREE_CODE (chrec1))
+    return false;
+
+  if (chrec0 == chrec1)
+    return true;
+
+  switch (TREE_CODE (chrec0))
+    {
+    case INTEGER_CST:
+      return integer_zerop (fold (build (MINUS_EXPR, TREE_TYPE (chrec0), 
+					 chrec0, chrec1)));
+    case POLYNOMIAL_CHREC:
+      return (CHREC_VARIABLE (chrec0) == CHREC_VARIABLE (chrec1)
+	      && eq_evolutions_p (CHREC_LEFT (chrec0), CHREC_LEFT (chrec1))
+	      && eq_evolutions_p (CHREC_RIGHT (chrec0), CHREC_RIGHT (chrec1)));
+    default:
+      return false;
+    }  
+}
+
Index: tree-chrec.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-chrec.h,v
retrieving revision 2.5.4.2
diff -d -u -p -r2.5.4.2 tree-chrec.h
--- tree-chrec.h	15 Dec 2004 18:26:15 -0000	2.5.4.2
+++ tree-chrec.h	19 Dec 2004 14:25:50 -0000
@@ -82,6 +82,7 @@ extern tree reset_evolution_in_loop (uns
 extern tree chrec_merge (tree, tree);
 
 /* Observers.  */
+extern bool eq_evolutions_p (tree, tree);
 extern bool is_multivariate_chrec (tree);
 extern bool chrec_is_positive (tree, bool *);
 extern bool chrec_contains_symbols (tree);
Index: tree-data-ref.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-data-ref.c,v
retrieving revision 2.15.4.4
diff -d -u -p -r2.15.4.4 tree-data-ref.c
--- tree-data-ref.c	15 Dec 2004 18:26:15 -0000	2.15.4.4
+++ tree-data-ref.c	19 Dec 2004 14:25:51 -0000
@@ -1825,7 +1825,7 @@ analyze_overlapping_iterations (tree chr
   
   /* If they are the same chrec, and are affine, they overlap 
      on every iteration.  */
-  else if (chrec_a == chrec_b
+  else if (eq_evolutions_p (chrec_a, chrec_b)
 	   && evolution_function_is_affine_multivariate_p (chrec_a))
     {
       *overlap_iterations_a = integer_zero_node;


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