From 5bc5d64aa606ee3de31585856367485eed3d00bd Mon Sep 17 00:00:00 2001
From: Sebastian Pop <sebpop@gmail.com>
Date: Mon, 14 Jun 2010 12:23:00 -0500
Subject: [PATCH] Schedule a copy_prop pass before graphite.
2010-06-15 Sebastian Pop <sebastian.pop@amd.com>
* passes.c (init_optimization_passes): Add pass_graphite.
Schedule a pass_copy_prop before pass_graphite_transforms.
* timevar.def (TV_GRAPHITE): Declared.
* tree-pass.h (pass_graphite): Declared.
* tree-ssa-loop.c (pass_graphite): New.
* gcc.dg/graphite/id-20.c: New.
---
gcc/ChangeLog.graphite | 10 ++++++++++
gcc/passes.c | 7 +++++--
gcc/testsuite/gcc.dg/graphite/id-20.c | 26 ++++++++++++++++++++++++++
gcc/timevar.def | 1 +
gcc/tree-pass.h | 1 +
gcc/tree-ssa-loop.c | 19 +++++++++++++++++++
6 files changed, 62 insertions(+), 2 deletions(-)
create mode 100644 gcc/testsuite/gcc.dg/graphite/id-20.c
@@ -1,3 +1,13 @@
+2010-06-15 Sebastian Pop <sebastian.pop@amd.com>
+
+ * passes.c (init_optimization_passes): Add pass_graphite.
+ Schedule a pass_copy_prop before pass_graphite_transforms.
+ * timevar.def (TV_GRAPHITE): Declared.
+ * tree-pass.h (pass_graphite): Declared.
+ * tree-ssa-loop.c (pass_graphite): New.
+
+ * gcc.dg/graphite/id-20.c: New.
+
2010-06-12 Sebastian Pop <sebastian.pop@amd.com>
* graphite-clast-to-gimple.c (gloog): Do not pass scops in parameter.
@@ -897,9 +897,12 @@ init_optimization_passes (void)
NEXT_PASS (pass_check_data_deps);
NEXT_PASS (pass_loop_distribution);
NEXT_PASS (pass_linear_transform);
- NEXT_PASS (pass_graphite_transforms);
+ NEXT_PASS (pass_copy_prop);
+ NEXT_PASS (pass_graphite);
{
- struct opt_pass **p = &pass_graphite_transforms.pass.sub;
+ struct opt_pass **p = &pass_graphite.pass.sub;
+ NEXT_PASS (pass_copy_prop);
+ NEXT_PASS (pass_graphite_transforms);
NEXT_PASS (pass_copy_prop);
NEXT_PASS (pass_dce_loop);
NEXT_PASS (pass_lim);
new file mode 100644
@@ -0,0 +1,26 @@
+/* { dg-options "-O3 -fgraphite-identity -ffast-math" } */
+
+typedef enum
+{
+ I_SLICE,
+} SliceType;
+typedef struct
+{
+ int type;
+} ImageParameters;
+extern ImageParameters *img;
+int A[64], B[64], C[13][8][8], D[13][8][8];
+
+void
+foo (int q, int temp)
+{
+ int i, j, k;
+ for(k=0; k<13; k++)
+ for(j=0; j<8; j++)
+ for(i=0; i<8; i++)
+ {
+ if (img->type == I_SLICE)
+ C[k][j][i] = A[temp] << q;
+ D[k][j][i] = B[temp] << q;
+ }
+}
@@ -146,6 +146,7 @@ DEFTIMEVAR (TV_COMPLETE_UNROLL , "complete unrolling")
DEFTIMEVAR (TV_TREE_PARALLELIZE_LOOPS, "tree parallelize loops")
DEFTIMEVAR (TV_TREE_VECTORIZATION , "tree vectorization")
DEFTIMEVAR (TV_TREE_SLP_VECTORIZATION, "tree slp vectorization")
+DEFTIMEVAR (TV_GRAPHITE , "Graphite")
DEFTIMEVAR (TV_GRAPHITE_TRANSFORMS , "Graphite loop transforms")
DEFTIMEVAR (TV_GRAPHITE_DATA_DEPS , "Graphite data dep analysis")
DEFTIMEVAR (TV_GRAPHITE_CODE_GEN , "Graphite code generation")
@@ -372,6 +372,7 @@ extern struct gimple_opt_pass pass_iv_canon;
extern struct gimple_opt_pass pass_scev_cprop;
extern struct gimple_opt_pass pass_empty_loop;
extern struct gimple_opt_pass pass_record_bounds;
+extern struct gimple_opt_pass pass_graphite;
extern struct gimple_opt_pass pass_graphite_transforms;
extern struct gimple_opt_pass pass_if_conversion;
extern struct gimple_opt_pass pass_loop_distribution;
@@ -309,6 +309,25 @@ gate_graphite_transforms (void)
return flag_graphite != 0;
}
+struct gimple_opt_pass pass_graphite =
+{
+ {
+ GIMPLE_PASS,
+ "graphite0", /* name */
+ gate_graphite_transforms, /* gate */
+ NULL, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ TV_GRAPHITE, /* tv_id */
+ PROP_cfg | PROP_ssa, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ 0 /* todo_flags_finish */
+ }
+};
+
struct gimple_opt_pass pass_graphite_transforms =
{
{
--
1.7.0.4