Patchwork [2/3] Use SSA_NAME_DEF_STMT only on SSA_NAMEs.

login
register
mail settings
Submitter Sebastian Pop
Date July 23, 2010, 5:48 a.m.
Message ID <1279864098-1408-3-git-send-email-sebpop@gmail.com>
Download mbox | patch
Permalink /patch/59734/
State New
Headers show

Comments

Sebastian Pop - July 23, 2010, 5:48 a.m.
2010-07-22  Sebastian Pop  <sebastian.pop@amd.com>

	* graphite-sese-to-poly.c (rewrite_phi_out_of_ssa): Use
	SSA_NAME_DEF_STMT only on SSA_NAMEs.

	* gcc.dg/graphite/id-24.c: New.
---
 gcc/ChangeLog.graphite                |    7 +++++++
 gcc/graphite-sese-to-poly.c           |    3 ++-
 gcc/testsuite/gcc.dg/graphite/id-24.c |   22 ++++++++++++++++++++++
 3 files changed, 31 insertions(+), 1 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/graphite/id-24.c
Diego Novillo - July 23, 2010, 11:52 a.m.
On Fri, Jul 23, 2010 at 01:48, Sebastian Pop <sebpop@gmail.com> wrote:
> 2010-07-22  Sebastian Pop  <sebastian.pop@amd.com>
>
>        * graphite-sese-to-poly.c (rewrite_phi_out_of_ssa): Use
>        SSA_NAME_DEF_STMT only on SSA_NAMEs.

OK.


Diego.

Patch

diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index e656c32..2174f0c 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,5 +1,12 @@ 
 2010-07-22  Sebastian Pop  <sebastian.pop@amd.com>
 
+	* graphite-sese-to-poly.c (rewrite_phi_out_of_ssa): Use
+	SSA_NAME_DEF_STMT only on SSA_NAMEs.
+
+	* gcc.dg/graphite/id-24.c: New.
+
+2010-07-22  Sebastian Pop  <sebastian.pop@amd.com>
+
 	* tree-scalar-evolution.c (instantiate_scev_name): Do not
 	instantiate default definitions.
 
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 2c85515..245fa8a 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -2255,7 +2255,8 @@  rewrite_phi_out_of_ssa (gimple_stmt_iterator *psi)
 
       /* Avoid the insertion of code in the loop latch to please the
 	 pattern matching of the vectorizer.  */
-      if (e->src == bb->loop_father->latch)
+      if (TREE_CODE (arg) == SSA_NAME
+	  && e->src == bb->loop_father->latch)
 	insert_out_of_ssa_copy (zero_dim_array, arg, SSA_NAME_DEF_STMT (arg));
       else
 	insert_out_of_ssa_copy_on_edge (e, zero_dim_array, arg);
diff --git a/gcc/testsuite/gcc.dg/graphite/id-24.c b/gcc/testsuite/gcc.dg/graphite/id-24.c
new file mode 100644
index 0000000..d466069
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/id-24.c
@@ -0,0 +1,22 @@ 
+/* gcc.dg/tree-ssa/loadpre23.c used to ICE with Graphite.  */
+
+struct {
+  int a;
+  int large[100];
+} x;
+
+int foo(int argc)
+{
+  int b;
+  int c;
+  int i;
+  int d, e;
+
+  for (i = 0; i < argc; i++)
+    {
+      e = x.a;
+      x.a = 9;
+    }
+  return d + e;
+}
+