Patchwork [65/65] Fix miscompile of 416.gamess.

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

Comments

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

2010-07-29  Sebastian Pop  <sebastian.pop@amd.com>

	* graphite-sese-to-poly.c (rewrite_close_phi_out_of_ssa): Add back
	the case removed in the previous patch, when the only phi argument
	is defined in the same loop as the phi node itself.  Handle it
	separately from the invariant case by both propagating it outside
	the region and replacing the phi node with an assign.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/graphite@162693 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog               |    8 ++++++++
 gcc/ChangeLog.graphite      |    8 ++++++++
 gcc/graphite-sese-to-poly.c |   10 ++++++++++
 3 files changed, 26 insertions(+), 0 deletions(-)

Patch

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3e01871..e58ccb7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,13 @@ 
 2010-08-02  Sebastian Pop  <sebastian.pop@amd.com>
 
+	* graphite-sese-to-poly.c (rewrite_close_phi_out_of_ssa): Add back
+	the case removed in the previous patch, when the only phi argument
+	is defined in the same loop as the phi node itself.  Handle it
+	separately from the invariant case by both propagating it outside
+	the region and replacing the phi node with an assign.
+
+2010-08-02  Sebastian Pop  <sebastian.pop@amd.com>
+
 	* graphite-sese-to-poly.c (rewrite_close_phi_out_of_ssa): The only
 	constant phi nodes with one argument are is_gimple_min_invariant
 	and SSA_NAME_IS_DEFAULT_DEF.
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index 1d3e64d..e43d2ce 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,3 +1,11 @@ 
+2010-07-29  Sebastian Pop  <sebastian.pop@amd.com>
+
+	* graphite-sese-to-poly.c (rewrite_close_phi_out_of_ssa): Add back
+	the case removed in the previous patch, when the only phi argument
+	is defined in the same loop as the phi node itself.  Handle it
+	separately from the invariant case by both propagating it outside
+	the region and replacing the phi node with an assign.
+
 2010-07-28  Sebastian Pop  <sebastian.pop@amd.com>
 
 	* graphite-sese-to-poly.c (rewrite_close_phi_out_of_ssa): The only
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 38e408c..4b94bcb 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -2249,6 +2249,16 @@  rewrite_close_phi_out_of_ssa (gimple_stmt_iterator *psi, sese region)
       return;
     }
 
+  else if (gimple_bb (SSA_NAME_DEF_STMT (arg))->loop_father == bb->loop_father)
+    {
+      propagate_expr_outside_region (res, arg, region);
+      stmt = gimple_build_assign (res, arg);
+      remove_phi_node (psi, false);
+      gsi_insert_before (&gsi, stmt, GSI_NEW_STMT);
+      SSA_NAME_DEF_STMT (res) = stmt;
+      return;
+    }
+
   /* If res is scev analyzable and is not a scalar value, it is safe
      to ignore the close phi node: it will be code generated in the
      out of Graphite pass.  */