summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2009-12-23 07:50:22 +0000
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2009-12-23 07:50:22 +0000
commit36f22aa0748a8c87061188133c325ea88e011a02 (patch)
treebc19cb772a32fa933310f85a572a15b8391b4296
parent673c512eedd5f8ead06667c114013635ca67933d (diff)
downloadgcc-36f22aa0748a8c87061188133c325ea88e011a02.tar.gz
Fix PR42205.
2009-12-17 Sebastian Pop <sebastian.pop@amd.com> PR middle-end/42205 * graphite-sese-to-poly.c (translate_scalar_reduction_to_array_for_stmt): Insert the reduction copy in the same block as the phi node. (follow_ssa_with_commutative_ops): Handle GIMPLE_NOPs. * testsuite/gcc.dg/graphite/pr42205-1.c: New. * testsuite/gcc.dg/graphite/pr42205-2.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155419 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog.graphite18
-rw-r--r--gcc/graphite-sese-to-poly.c7
-rw-r--r--gcc/testsuite/gcc.dg/graphite/pr42205-1.c17
-rw-r--r--gcc/testsuite/gcc.dg/graphite/pr42205-2.c11
4 files changed, 51 insertions, 2 deletions
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index 232e13d7696..ac1c4d6cfab 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,5 +1,23 @@
2009-12-17 Sebastian Pop <sebastian.pop@amd.com>
+ PR middle-end/42205
+ * graphite-sese-to-poly.c (translate_scalar_reduction_to_array_for_stmt):
+ Insert the reduction copy in the same block as the phi node.
+ (follow_ssa_with_commutative_ops): Handle GIMPLE_NOPs.
+
+ * testsuite/gcc.dg/graphite/pr42205-1.c: New.
+ * testsuite/gcc.dg/graphite/pr42205-2.c: New.
+
+2009-12-17 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR middle-end/42221
+ * sese.c (expand_scalar_variables_expr): Follow the SSA links into
+ the array indexing of ADDR_EXPRs.
+
+ * testsuite/gcc.dg/graphite/pr42221.c: New.
+
+2009-12-17 Sebastian Pop <sebastian.pop@amd.com>
+
PR middle-end/42178
PR middle-end/42334
* graphite-interchange.c (lst_try_interchange): Do not modify OUTER
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 370bbff5ddd..7b61ed72a21 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -2498,6 +2498,9 @@ follow_ssa_with_commutative_ops (tree arg, tree lhs)
stmt = SSA_NAME_DEF_STMT (arg);
+ if (gimple_code (stmt) == GIMPLE_NOP)
+ return NULL;
+
if (gimple_code (stmt) == GIMPLE_PHI)
{
if (phi_contains_arg (stmt, lhs))
@@ -2674,13 +2677,13 @@ static void
translate_scalar_reduction_to_array_for_stmt (tree red, gimple stmt,
gimple loop_phi)
{
- basic_block bb = gimple_bb (stmt);
- gimple_stmt_iterator insert_gsi = gsi_after_labels (bb);
+ gimple_stmt_iterator insert_gsi = gsi_after_labels (gimple_bb (loop_phi));
tree res = gimple_phi_result (loop_phi);
gimple assign = gimple_build_assign (res, red);
gsi_insert_before (&insert_gsi, assign, GSI_SAME_STMT);
+ insert_gsi = gsi_after_labels (gimple_bb (stmt));
assign = gimple_build_assign (red, gimple_assign_lhs (stmt));
insert_gsi = gsi_for_stmt (stmt);
gsi_insert_after (&insert_gsi, assign, GSI_SAME_STMT);
diff --git a/gcc/testsuite/gcc.dg/graphite/pr42205-1.c b/gcc/testsuite/gcc.dg/graphite/pr42205-1.c
new file mode 100644
index 00000000000..413b9f7eab8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/pr42205-1.c
@@ -0,0 +1,17 @@
+/* { dg-options "-O1 -ffast-math -floop-interchange" } */
+
+int adler32(int adler, char *buf, int n)
+{
+ int sum = 0;
+ do {
+ adler += buf[0];
+ sum += adler;
+ adler += buf[1];
+ sum += adler;
+ adler += buf[2];
+ sum += adler;
+ adler += buf[3];
+ sum += adler;
+ } while (--n);
+ return adler | (sum << 16);
+}
diff --git a/gcc/testsuite/gcc.dg/graphite/pr42205-2.c b/gcc/testsuite/gcc.dg/graphite/pr42205-2.c
new file mode 100644
index 00000000000..595cedb90a5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/pr42205-2.c
@@ -0,0 +1,11 @@
+/* { dg-options "-O1 -funsafe-math-optimizations -floop-interchange" } */
+
+double f(double x)
+{
+ double y = 0.0;
+ int i;
+ for (i = 0; i < 8; i++) {
+ y += x * i;
+ }
+ return y;
+}