summaryrefslogtreecommitdiff
path: root/gcc/graphite-sese-to-poly.c
diff options
context:
space:
mode:
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2009-11-25 04:55:53 +0000
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2009-11-25 04:55:53 +0000
commitf007fe9730d912ef3185d08f3835d5e4680f2331 (patch)
tree691791191c1405beb47bca42a0c50bebbd5d5502 /gcc/graphite-sese-to-poly.c
parent4d0382bc1a3eb50c7d7964e0a3f639728d61e94d (diff)
downloadgcc-f007fe9730d912ef3185d08f3835d5e4680f2331.tar.gz
2009-10-06 Sebastian Pop <sebastian.pop@amd.com>
* graphite-dependences.c (reduction_dr_1): New. (reduction_dr_p): New. (graphite_legal_transform_dr): Call reduction_dr_p. (reduction_ddr): Renamed reduction_ddr_p. * graphite-poly.h (same_pdr_p): New. (number_of_write_pdrs): New. * graphite-sese-to-poly.c (nb_data_writes_in_bb): New. (split_reduction_stmt): Do not split reduction statements when there are no writes to memory. (translate_scalar_reduction_to_array_for_stmt): Insert the memory reduction statement just after the scalar reduction statement. * gcc.dg/graphite/interchange-10.c: Updated to differ from interchange-4.c. Un-XFAIL-ed. * gcc.dg/graphite/interchange-3.c: Un-XFAIL-ed. * gcc.dg/graphite/interchange-4.c: Un-XFAIL-ed. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154564 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/graphite-sese-to-poly.c')
-rw-r--r--gcc/graphite-sese-to-poly.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 807e287f622..75d10c69869 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -2213,6 +2213,22 @@ nb_pbbs_in_loops (scop_p scop)
return res;
}
+/* Return the number of data references in BB that write in
+ memory. */
+
+static int
+nb_data_writes_in_bb (basic_block bb)
+{
+ int res = 0;
+ gimple_stmt_iterator gsi;
+
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ if (gimple_vdef (gsi_stmt (gsi)))
+ res++;
+
+ return res;
+}
+
/* Splits STMT out of its current BB. */
static basic_block
@@ -2222,6 +2238,11 @@ split_reduction_stmt (gimple stmt)
basic_block bb = gimple_bb (stmt);
edge e;
+ /* Do not split basic blocks with no writes to memory: the reduction
+ will be the only write to memory. */
+ if (nb_data_writes_in_bb (bb) == 0)
+ return bb;
+
split_block (bb, stmt);
gsi = gsi_last_bb (bb);
@@ -2444,7 +2465,7 @@ translate_scalar_reduction_to_array_for_stmt (tree red, gimple stmt,
gsi_insert_before (&insert_gsi, assign, GSI_SAME_STMT);
assign = gimple_build_assign (red, gimple_assign_lhs (stmt));
- insert_gsi = gsi_last_bb (bb);
+ insert_gsi = gsi_for_stmt (stmt);
gsi_insert_after (&insert_gsi, assign, GSI_SAME_STMT);
}