Patchwork [12/12] Unshare the scev before code generating it.

login
register
mail settings
Submitter Sebastian Pop
Date July 16, 2010, 7:04 a.m.
Message ID <1279263843-9149-13-git-send-email-sebpop@gmail.com>
Download mbox | patch
Permalink /patch/59080/
State New
Headers show

Comments

Sebastian Pop - July 16, 2010, 7:04 a.m.
2010-07-15  Sebastian Pop  <sebastian.pop@amd.com>

	* sese.c (rename_uses): Call unshare_expr before force_gimple_operand.

	* gcc.dg/graphite/id-23.c: New.
---
 gcc/ChangeLog.graphite                |    6 ++++++
 gcc/sese.c                            |    3 ++-
 gcc/testsuite/gcc.dg/graphite/id-23.c |   22 ++++++++++++++++++++++
 3 files changed, 30 insertions(+), 1 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/graphite/id-23.c

Patch

diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index 6600df7..1cf50f3 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,5 +1,11 @@ 
 2010-07-15  Sebastian Pop  <sebastian.pop@amd.com>
 
+	* sese.c (rename_uses): Call unshare_expr before force_gimple_operand.
+
+	* gcc.dg/graphite/id-23.c: New.
+
+2010-07-15  Sebastian Pop  <sebastian.pop@amd.com>
+
 	* graphite-sese-to-poly.c (reduction_phi_p): Do not rewrite out of
 	SSA scalar phi nodes that can be scev_analyzable_p.
 
diff --git a/gcc/sese.c b/gcc/sese.c
index f59f317..3f7266b 100644
--- a/gcc/sese.c
+++ b/gcc/sese.c
@@ -543,7 +543,8 @@  rename_uses (gimple copy, htab_t rename_map, gimple_stmt_iterator *gsi_tgt,
 		  && !tree_contains_chrecs (new_expr, NULL));
 
       /* Replace the old_name with the new_expr.  */
-      new_expr = force_gimple_operand (new_expr, &stmts, true, NULL);
+      new_expr = force_gimple_operand (unshare_expr (new_expr), &stmts,
+				       true, NULL);
       gsi_insert_seq_before (gsi_tgt, stmts, GSI_SAME_STMT);
       replace_exp (use_p, new_expr);
       set_rename (rename_map, old_name, new_expr);
diff --git a/gcc/testsuite/gcc.dg/graphite/id-23.c b/gcc/testsuite/gcc.dg/graphite/id-23.c
new file mode 100644
index 0000000..0f8a1f3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/id-23.c
@@ -0,0 +1,22 @@ 
+double *ZV_entries (void);
+void SubMtx_fillRowZV (int irow)
+{
+  double *rowvec = ZV_entries ();
+  double *entries;
+  int ii, ipivot, jrow, kk, m;
+  int *pivotsizes;
+
+  SubMtx_blockDiagonalInfo (&pivotsizes);
+
+  for (jrow = ipivot = kk = 0; jrow <= irow; ipivot++)
+    {
+      m = pivotsizes[ipivot];
+      if (jrow <= irow && irow < jrow + m)
+	for (ii = jrow; ii < irow; ii++)
+	  {
+	    rowvec[2*ii] = entries[2*kk];
+	    rowvec[2*ii+1] = entries[2*kk+1];
+	  }
+      jrow += m;
+    }
+}