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

login
register
mail settings
Submitter Sebastian Pop
Date Aug. 20, 2010, 11:44 p.m.
Message ID <1282347880-797-3-git-send-email-sebpop@gmail.com>
Download mbox | patch
Permalink /patch/62332/
State New
Headers show

Comments

Sebastian Pop - Aug. 20, 2010, 11:44 p.m.
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(-)

Patch

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.  */