2011-01-25 Sebastian Pop <sebastian.pop@amd.com>
* graphite-sese-to-poly.c
(translate_scalar_reduction_to_array_for_stmt): Call unshare_expr.
(close_phi_written_to_memory): New.
(translate_scalar_reduction_to_array): Call close_phi_written_to_memory
and unshare_expr.
* gcc.dg/graphite/block-0.c: Un-XFAILed.
* gcc.dg/graphite/block-1.c: Un-XFAILed.
* gcc.dg/graphite/block-7.c: Un-XFAILed.
* gcc.dg/graphite/block-8.c: Un-XFAILed.
* gcc.dg/graphite/interchange-12.c: Un-XFAILed.
* gcc.dg/graphite/interchange-14.c: Un-XFAILed.
* gcc.dg/graphite/interchange-15.c: Un-XFAILed.
* gcc.dg/graphite/interchange-8.c: Un-XFAILed.
* gcc.dg/graphite/interchange-mvt.c: Un-XFAILed.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@169208
138bc75d-0d04-0410-961f-
82ee72b054a4
2011-01-25 Sebastian Pop <sebastian.pop@amd.com>
+ * graphite-sese-to-poly.c
+ (translate_scalar_reduction_to_array_for_stmt): Call unshare_expr.
+ (close_phi_written_to_memory): New.
+ (translate_scalar_reduction_to_array): Call close_phi_written_to_memory
+ and unshare_expr.
+
+2011-01-25 Sebastian Pop <sebastian.pop@amd.com>
+
* doc/install.texi: Update the expected version number of PPL to 0.11.
* graphite-ppl.c (ppl_powerset_is_empty): Remove now dead code under
#if PPL_VERSION_MINOR < 11.
2011-01-15 Sebastian Pop <sebastian.pop@amd.com>
+ * graphite-sese-to-poly.c
+ (translate_scalar_reduction_to_array_for_stmt): Call unshare_expr.
+ (close_phi_written_to_memory): New.
+ (translate_scalar_reduction_to_array): Call close_phi_written_to_memory
+ and unshare_expr.
+
+ * gcc.dg/graphite/block-0.c: Un-XFAILed.
+ * gcc.dg/graphite/block-1.c: Un-XFAILed.
+ * gcc.dg/graphite/block-7.c: Un-XFAILed.
+ * gcc.dg/graphite/block-8.c: Un-XFAILed.
+ * gcc.dg/graphite/interchange-12.c: Un-XFAILed.
+ * gcc.dg/graphite/interchange-14.c: Un-XFAILed.
+ * gcc.dg/graphite/interchange-15.c: Un-XFAILed.
+ * gcc.dg/graphite/interchange-8.c: Un-XFAILed.
+ * gcc.dg/graphite/interchange-mvt.c: Un-XFAILed.
+
+2011-01-15 Sebastian Pop <sebastian.pop@amd.com>
+
* doc/install.texi: Update the expected version number of PPL to 0.11.
* graphite-ppl.c (ppl_powerset_is_empty): Remove now dead code under
#if PPL_VERSION_MINOR < 11.
gimple stmt, gimple loop_phi)
{
tree res = gimple_phi_result (loop_phi);
- gimple assign = gimple_build_assign (res, red);
+ gimple assign = gimple_build_assign (res, unshare_expr (red));
gimple_stmt_iterator gsi;
insert_stmts (scop, assign, NULL, gsi_after_labels (gimple_bb (loop_phi)));
- assign = gimple_build_assign (red, gimple_assign_lhs (stmt));
+ assign = gimple_build_assign (unshare_expr (red), gimple_assign_lhs (stmt));
gsi = gsi_for_stmt (stmt);
gsi_next (&gsi);
insert_stmts (scop, assign, NULL, gsi);
remove_phi_node (&gsi, false);
}
+/* When the result of a CLOSE_PHI is written to a memory location,
+ return a pointer to that memory reference, otherwise return
+ NULL_TREE. */
+
+static tree
+close_phi_written_to_memory (gimple close_phi)
+{
+ imm_use_iterator imm_iter;
+ tree res, def = gimple_phi_result (close_phi);
+ use_operand_p use_p;
+ gimple stmt;
+
+ FOR_EACH_IMM_USE_FAST (use_p, imm_iter, def)
+ if ((stmt = USE_STMT (use_p))
+ && gimple_code (stmt) == GIMPLE_ASSIGN
+ && (res = gimple_assign_lhs (stmt))
+ && (TREE_CODE (res) == ARRAY_REF
+ || TREE_CODE (res) == MEM_REF))
+ return res;
+
+ return NULL_TREE;
+}
+
/* Rewrite out of SSA the reduction described by the loop phi nodes
IN, and the close phi nodes OUT. IN and OUT are structured by loop
levels like this:
VEC (gimple, heap) *in,
VEC (gimple, heap) *out)
{
- unsigned int i;
gimple loop_phi;
- tree red = NULL_TREE;
+ unsigned int i = VEC_length (gimple, out) - 1;
+ tree red = close_phi_written_to_memory (VEC_index (gimple, out, i));
FOR_EACH_VEC_ELT (gimple, in, i, loop_phi)
{
PBB_IS_REDUCTION (pbb) = true;
gcc_assert (close_phi == loop_phi);
- red = create_zero_dim_array
- (gimple_assign_lhs (stmt), "Commutative_Associative_Reduction");
+ if (!red)
+ red = create_zero_dim_array
+ (gimple_assign_lhs (stmt), "Commutative_Associative_Reduction");
+
translate_scalar_reduction_to_array_for_stmt
(scop, red, stmt, VEC_index (gimple, in, 1));
continue;
if (i == VEC_length (gimple, in) - 1)
{
- insert_out_of_ssa_copy (scop, gimple_phi_result (close_phi), red,
- close_phi);
+ insert_out_of_ssa_copy (scop, gimple_phi_result (close_phi),
+ unshare_expr (red), close_phi);
insert_out_of_ssa_copy_on_edge
(scop, edge_initial_value_for_loop_phi (loop_phi),
- red, initial_value_for_loop_phi (loop_phi));
+ unshare_expr (red), initial_value_for_loop_phi (loop_phi));
}
remove_phi (loop_phi);
2011-01-25 Sebastian Pop <sebastian.pop@amd.com>
+ * gcc.dg/graphite/block-0.c: Un-XFAILed.
+ * gcc.dg/graphite/block-1.c: Un-XFAILed.
+ * gcc.dg/graphite/block-7.c: Un-XFAILed.
+ * gcc.dg/graphite/block-8.c: Un-XFAILed.
+ * gcc.dg/graphite/interchange-12.c: Un-XFAILed.
+ * gcc.dg/graphite/interchange-14.c: Un-XFAILed.
+ * gcc.dg/graphite/interchange-15.c: Un-XFAILed.
+ * gcc.dg/graphite/interchange-8.c: Un-XFAILed.
+ * gcc.dg/graphite/interchange-mvt.c: Un-XFAILed.
+
+2011-01-25 Sebastian Pop <sebastian.pop@amd.com>
+
* gcc.dg/graphite/block-0.c: Add documentation.
* gcc.dg/graphite/block-4.c: Same.
* gcc.dg/graphite/block-7.c: Same.
int j;
int i;
- /* This should be blocked. */
+ /* This is not blocked as it is not profitable. */
for (i = 0; i < N; i++)
for (j = 0; j < N; j++)
a[j] = a[i] + 1;
return 0;
}
-/* { dg-final { scan-tree-dump-times "will be loop blocked" 1 "graphite" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-not "will be loop blocked" "graphite" } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
int A[MAX * MAX];
int B[MAX * MAX];
+ /* These loops should be loop blocked. */
for (i = 0; i < MAX; i++)
for (j = 0; j < MAX; j++)
{
B[i*MAX + j] = j;
}
+ /* These loops should be loop blocked. */
for (i = 0; i < MAX; i++)
for (j = 0; j < MAX; j++)
A[i*MAX + j] += B[j*MAX + i];
+ /* These loops should be loop blocked. */
for(i = 0; i < MAX; i++)
for(j = 0; j < MAX; j++)
sum += A[i*MAX + j];
return 0;
}
-/* { dg-final { scan-tree-dump-times "will be loop blocked" 2 "graphite" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "will be loop blocked" 3 "graphite" } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
return 0;
}
-/* { dg-final { scan-tree-dump-times "will be loop blocked" 1 "graphite" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "will be loop blocked" 1 "graphite" } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
return 0;
}
-/* { dg-final { scan-tree-dump-times "will be loop blocked" 1 "graphite" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "will be loop blocked" 1 "graphite" } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
{
int i, j, k;
- /* This should be interchanged twice: (i, k) and (j, i). The
- resulting nest should look like this (k, i, j). */
+ /* Loops J and K should be interchanged. */
for (i = 0; i < N; i++)
for (j = 0; j < N; j++)
{
return 0;
}
-/* { dg-final { scan-tree-dump-times "will be interchanged" 2 "graphite" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
for (j = 0; j < N; j++)
A[i][j] = 0;
- /* This should be interchanged twice: (i, k) and (j, i). The
- resulting nest should look like this (k, i, j). */
+ /* Loops J and K should be interchanged. */
for (i = 0; i < N; i++)
for (j = 0; j < N; j++)
for (k = 0; k < N; k++)
return 0;
}
-/* { dg-final { scan-tree-dump-times "will be interchanged" 2 "graphite" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
return 0;
}
-/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
{
int i, j, k, l;
- /* Loops K and L should be interchanged. */
+ /* Loops (L, J) are interchanged, and then loops (J and K) are
+ interchanged. The result is a nest starting with (K, J, L). */
for (l = 0; l < 4; l++)
{
for (k = 0; k < 4; k++)
return 0;
}
-/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "will be interchanged" 2 "graphite" } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
return 0;
}
-/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */