Patchwork [16/65] Schedule a copy_prop pass before graphite.

login
register
mail settings
Submitter Sebastian Pop
Date Aug. 2, 2010, 8:19 p.m.
Message ID <1280780438-17543-17-git-send-email-sebpop@gmail.com>
Download mbox | patch
Permalink /patch/60614/
State New
Headers show

Comments

Sebastian Pop - Aug. 2, 2010, 8:19 p.m.
From: spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>

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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/graphite@160791 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog                         |    8 ++++++++
 gcc/ChangeLog.graphite                |   10 ++++++++++
 gcc/passes.c                          |    7 +++++--
 gcc/testsuite/ChangeLog               |    4 ++++
 gcc/testsuite/gcc.dg/graphite/id-20.c |   26 ++++++++++++++++++++++++++
 gcc/timevar.def                       |    1 +
 gcc/tree-pass.h                       |    1 +
 gcc/tree-ssa-loop.c                   |   19 +++++++++++++++++++
 8 files changed, 74 insertions(+), 2 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/graphite/id-20.c

Patch

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d05f124..f08de60 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,13 @@ 
 2010-08-02  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.
+
+2010-08-02  Sebastian Pop  <sebastian.pop@amd.com>
+
 	* graphite-clast-to-gimple.c (gloog): Do not pass scops in parameter.
 	Remove calls to rename_nb_iterations and rename_sese_parameters.
 	* graphite-clast-to-gimple.h (gloog): Update declaration.
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index aac1c96..8b72f3e 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -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.
diff --git a/gcc/passes.c b/gcc/passes.c
index 5a4cdc8..e2b9369 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -900,9 +900,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);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 136a739..d4d8d90 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@ 
+2010-08-02  Sebastian Pop  <sebastian.pop@amd.com>
+
+	* gcc.dg/graphite/id-20.c: New.
+
 2010-08-02  Bernd Schmidt  <bernds@codesourcery.com>
 
 	PR target/40457
diff --git a/gcc/testsuite/gcc.dg/graphite/id-20.c b/gcc/testsuite/gcc.dg/graphite/id-20.c
new file mode 100644
index 0000000..7e0cf6d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/id-20.c
@@ -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;
+	}
+}
diff --git a/gcc/timevar.def b/gcc/timevar.def
index a28d6ba..86e2999 100644
--- a/gcc/timevar.def
+++ b/gcc/timevar.def
@@ -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")
diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
index 33c898e..84d4a88 100644
--- a/gcc/tree-pass.h
+++ b/gcc/tree-pass.h
@@ -373,6 +373,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;
diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c
index 7a60144..9523dab 100644
--- a/gcc/tree-ssa-loop.c
+++ b/gcc/tree-ssa-loop.c
@@ -310,6 +310,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 =
 {
  {