Patchwork [26/65] Fix 435.gromacs miscompile: call rewrite_close_phi_out_of_ssa from rewrite_cross_bb_phi_deps.

login
register
mail settings
Submitter Sebastian Pop
Date Aug. 2, 2010, 8:19 p.m.
Message ID <1280780438-17543-27-git-send-email-sebpop@gmail.com>
Download mbox | patch
Permalink /patch/60624/
State New
Headers show

Comments

Sebastian Pop - Aug. 2, 2010, 8:19 p.m.
From: spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>

2010-06-24  Sebastian Pop  <sebastian.pop@amd.com>

	* graphite-sese-to-poly.c (rewrite_cross_bb_phi_deps): Call
	rewrite_close_phi_out_of_ssa.

	* gcc.dg/graphite/id-22.c: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/graphite@161359 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog                         |    5 +++++
 gcc/ChangeLog.graphite                |    7 +++++++
 gcc/graphite-sese-to-poly.c           |    8 ++++++--
 gcc/testsuite/ChangeLog               |    4 ++++
 gcc/testsuite/gcc.dg/graphite/id-22.c |   15 +++++++++++++++
 5 files changed, 37 insertions(+), 2 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/graphite/id-22.c

Patch

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 95b5413..2013c55 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@ 
 2010-08-02  Sebastian Pop  <sebastian.pop@amd.com>
 
+	* graphite-sese-to-poly.c (rewrite_cross_bb_phi_deps): Call
+	rewrite_close_phi_out_of_ssa.
+
+2010-08-02  Sebastian Pop  <sebastian.pop@amd.com>
+
 	* graphite-sese-to-poly.c (rewrite_cross_bb_phi_deps): Remove dead code.
 
 2010-08-02  Sebastian Pop  <sebastian.pop@amd.com>
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index c2be7c7..ee63b7c 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,5 +1,12 @@ 
 2010-06-24  Sebastian Pop  <sebastian.pop@amd.com>
 
+	* graphite-sese-to-poly.c (rewrite_cross_bb_phi_deps): Call
+	rewrite_close_phi_out_of_ssa.
+
+	* gcc.dg/graphite/id-22.c: New.
+
+2010-06-24  Sebastian Pop  <sebastian.pop@amd.com>
+
 	* graphite-sese-to-poly.c (rewrite_cross_bb_phi_deps): Remove dead code.
 
 2010-06-24  Sebastian Pop  <sebastian.pop@amd.com>
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 318401e..8857946 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -2361,8 +2361,12 @@  rewrite_cross_bb_phi_deps (sese region, gimple_stmt_iterator gsi)
   FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, def)
     if (gimple_code (use_stmt) == GIMPLE_PHI)
       {
-	gimple_stmt_iterator si = gsi_for_stmt (use_stmt);
-	rewrite_phi_out_of_ssa (&si);
+	gimple_stmt_iterator psi = gsi_for_stmt (use_stmt);
+
+	if (scalar_close_phi_node_p (gsi_stmt (psi)))
+	  rewrite_close_phi_out_of_ssa (&psi);
+	else
+	  rewrite_phi_out_of_ssa (&psi);
       }
 }
 
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 90c2798..2463668 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,9 @@ 
 2010-08-02  Sebastian Pop  <sebastian.pop@amd.com>
 
+	* gcc.dg/graphite/id-22.c: New.
+
+2010-08-02  Sebastian Pop  <sebastian.pop@amd.com>
+
 	* gcc.dg/graphite/run-id-2.c: Call abort.
 
 2010-08-02  Sebastian Pop  <sebastian.pop@amd.com>
diff --git a/gcc/testsuite/gcc.dg/graphite/id-22.c b/gcc/testsuite/gcc.dg/graphite/id-22.c
new file mode 100644
index 0000000..d825542
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/id-22.c
@@ -0,0 +1,15 @@ 
+typedef float rvec[3];
+float calc_similar_ind (int nind, rvec x[])
+{
+  int i, j, d;
+  float m, tm, xd, rd;
+  for(j=0; j<nind; j++) {
+    i = x[j][0];
+    tm += m;
+    for(d=0 ; d<3; d++) {
+      xd = x[i][d] - x[i][d];
+      rd += m * xd;
+    }
+  }
+    return rd/tm;
+}