Patchwork [graphite] Remove sese_adjust_liveout_phis

login
register
mail settings
Submitter Sebastian Pop
Date June 15, 2010, 3:15 p.m.
Message ID <AANLkTinwCgI1qrzBJ_pYs8LFDS9N92P34RdlwLOgYfef@mail.gmail.com>
Download mbox | patch
Permalink /patch/55699/
State New
Headers show

Comments

Sebastian Pop - June 15, 2010, 3:15 p.m.
On Tue, Jun 15, 2010 at 03:21, Richard Guenther <rguenther@suse.de> wrote:
> Make pass_graphite_transforms a wrapper only (similar to
> pass_tree_loop), put the real graphite-transforms pass inside,
> preceeded by copyprop.

Thanks for the recommendation.
Attached is the patch that I committed to the Graphite branch for further test.

Sebastian

Patch

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

diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index b4e2700..fa75c61 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 ad444fd..093d8e8 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -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);
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 a6ee4d2..9d56124 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 b5971d5..9af12d9 100644
--- a/gcc/tree-pass.h
+++ b/gcc/tree-pass.h
@@ -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;
diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c
index 344cfa8..006688a 100644
--- a/gcc/tree-ssa-loop.c
+++ b/gcc/tree-ssa-loop.c
@@ -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