[PATCH 2/6] A function is affine when CHREC_RIGHT is invariant.

Sebastian Pop sebpop@gmail.com
Sat Aug 21 01:10:00 GMT 2010


2010-08-20  Sebastian Pop  <sebastian.pop@amd.com>

	* tree-chrec.h (evolution_function_is_affine_p): Do not check
	whether CHREC_LEFT is invariant.  A function is affine when
	CHREC_RIGHT is invariant.
---
 gcc/ChangeLog.graphite |    6 ++++++
 gcc/tree-chrec.h       |   21 ++++-----------------
 2 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index 34bd5be..16b5dfa 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,5 +1,11 @@
 2010-08-20  Sebastian Pop  <sebastian.pop@amd.com>
 
+	* tree-chrec.h (evolution_function_is_affine_p): Do not check
+	whether CHREC_LEFT is invariant.  A function is affine when
+	CHREC_RIGHT is invariant.
+
+2010-08-20  Sebastian Pop  <sebastian.pop@amd.com>
+
 	* graphite-sese-to-poly.c (reduction_phi_p): Remove check for
 	is_gimple_reg.
 	(rewrite_degenerate_phi): Same.
diff --git a/gcc/tree-chrec.h b/gcc/tree-chrec.h
index eb60ac9..58b14e7 100644
--- a/gcc/tree-chrec.h
+++ b/gcc/tree-chrec.h
@@ -202,23 +202,10 @@ evolution_function_is_affine_in_loop (const_tree chrec, int loopnum)
 static inline bool
 evolution_function_is_affine_p (const_tree chrec)
 {
-  if (chrec == NULL_TREE)
-    return false;
-
-  switch (TREE_CODE (chrec))
-    {
-    case POLYNOMIAL_CHREC:
-      if (evolution_function_is_invariant_p (CHREC_LEFT (chrec),
-					     CHREC_VARIABLE (chrec))
-	  && evolution_function_is_invariant_p (CHREC_RIGHT (chrec),
-						CHREC_VARIABLE (chrec)))
-	return true;
-      else
-	return false;
-
-    default:
-      return false;
-    }
+  return chrec
+    && TREE_CODE (chrec) == POLYNOMIAL_CHREC
+    && evolution_function_is_invariant_p (CHREC_RIGHT (chrec),
+					  CHREC_VARIABLE (chrec));
 }
 
 /* Determines whether EXPR does not contains chrec expressions.  */
-- 
1.7.0.4



More information about the Gcc-patches mailing list