Patchwork [20/44] Fix chrec_contains_symbols_defined_in_loop.

login
register
mail settings
Submitter Sebastian Pop
Date Sept. 30, 2010, 6:01 p.m.
Message ID <1285869696-10915-21-git-send-email-sebpop@gmail.com>
Download mbox | patch
Permalink /patch/66206/
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-scalar-evolution.c (chrec_contains_symbols_defined_in_loop):
	Do not check for VAR_DECL, PARM_DECL, FUNCTION_DECL, LABEL_DECL,
	RESULT_DECL, and FIELD_DECL.  Return false for an
	SSA_NAME_IS_DEFAULT_DEF.
	(compute_scalar_evolution_in_loop): Do not further analyze the
	scalar evolution when no_evolution_in_loop_p returns true.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/graphite@163430 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog               |    9 +++++++++
 gcc/ChangeLog.graphite      |    9 +++++++++
 gcc/tree-scalar-evolution.c |   25 ++++++++++++++-----------
 3 files changed, 32 insertions(+), 11 deletions(-)

Patch

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index aa937ea..91a74e6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,14 @@ 
 2010-09-30  Sebastian Pop  <sebastian.pop@amd.com>
 
+	* tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop):
+	Do not check for VAR_DECL, PARM_DECL, FUNCTION_DECL, LABEL_DECL,
+	RESULT_DECL, and FIELD_DECL.  Return false for an
+	SSA_NAME_IS_DEFAULT_DEF.
+	(compute_scalar_evolution_in_loop): Do not further analyze the
+	scalar evolution when no_evolution_in_loop_p returns true.
+
+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.
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index 93b999d..ea6bb12 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,5 +1,14 @@ 
 2010-08-20  Sebastian Pop  <sebastian.pop@amd.com>
 
+	* tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop):
+	Do not check for VAR_DECL, PARM_DECL, FUNCTION_DECL, LABEL_DECL,
+	RESULT_DECL, and FIELD_DECL.  Return false for an
+	SSA_NAME_IS_DEFAULT_DEF.
+	(compute_scalar_evolution_in_loop): Do not further analyze the
+	scalar evolution when no_evolution_in_loop_p returns true.
+
+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.
diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c
index c7f45f2..a7e165a 100644
--- a/gcc/tree-scalar-evolution.c
+++ b/gcc/tree-scalar-evolution.c
@@ -385,19 +385,17 @@  chrec_contains_symbols_defined_in_loop (const_tree chrec, unsigned loop_nb)
   if (is_gimple_min_invariant (chrec))
     return false;
 
-  if (TREE_CODE (chrec) == VAR_DECL
-      || TREE_CODE (chrec) == PARM_DECL
-      || TREE_CODE (chrec) == FUNCTION_DECL
-      || TREE_CODE (chrec) == LABEL_DECL
-      || TREE_CODE (chrec) == RESULT_DECL
-      || TREE_CODE (chrec) == FIELD_DECL)
-    return true;
-
   if (TREE_CODE (chrec) == SSA_NAME)
     {
-      gimple def = SSA_NAME_DEF_STMT (chrec);
-      struct loop *def_loop = loop_containing_stmt (def);
-      struct loop *loop = get_loop (loop_nb);
+      gimple def;
+      loop_p def_loop, loop;
+
+      if (SSA_NAME_IS_DEFAULT_DEF (chrec))
+	return false;
+
+      def = SSA_NAME_DEF_STMT (chrec);
+      def_loop = loop_containing_stmt (def);
+      loop = get_loop (loop_nb);
 
       if (def_loop == NULL)
 	return false;
@@ -1834,13 +1832,18 @@  compute_scalar_evolution_in_loop (struct loop *wrto_loop,
 				  struct loop *def_loop,
 				  tree ev)
 {
+  bool val;
   tree res;
+
   if (def_loop == wrto_loop)
     return ev;
 
   def_loop = superloop_at_depth (def_loop, loop_depth (wrto_loop) + 1);
   res = compute_overall_effect_of_inner_loop (def_loop, ev);
 
+  if (no_evolution_in_loop_p (res, wrto_loop->num, &val) && val)
+    return res;
+
   return analyze_scalar_evolution_1 (wrto_loop, res, chrec_not_analyzed_yet);
 }