Patchwork [19/44] A function is affine when CHREC_RIGHT is invariant.

login
register
mail settings
Submitter Sebastian Pop
Date Sept. 30, 2010, 6:01 p.m.
Message ID <1285869696-10915-20-git-send-email-sebpop@gmail.com>
Download mbox | patch
Permalink /patch/66204/
State New
Headers show

Comments

Sebastian Pop - Sept. 30, 2010, 6:01 p.m.
From: spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>

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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/graphite@163429 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog          |    6 ++++++
 gcc/ChangeLog.graphite |    6 ++++++
 gcc/tree-chrec.h       |   21 ++++-----------------
 3 files changed, 16 insertions(+), 17 deletions(-)

Patch

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5c5eb20..aa937ea 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@ 
 2010-09-30  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-09-30  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/ChangeLog.graphite b/gcc/ChangeLog.graphite
index e48ee07..93b999d 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.  */