public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Run pass_expand_omp_ssa after pass_paralellize_loops
       [not found]           ` <542AB218.5060502@mentor.com>
@ 2014-11-12 13:16             ` Tom de Vries
  2014-11-12 14:15               ` David Malcolm
  2014-11-12 14:24               ` Richard Biener
  0 siblings, 2 replies; 5+ messages in thread
From: Tom de Vries @ 2014-11-12 13:16 UTC (permalink / raw)
  To: Richard Biener; +Cc: Jakub Jelinek, GCC Patches, Thomas Schwinge, Bernd Schmidt

[-- Attachment #1: Type: text/plain, Size: 1425 bytes --]

[ moved from gcc@ to gcc-patches@ ]
[ subject was: Re: [gomp4] openacc kernels directive support ]
On 30-09-14 15:37, Tom de Vries wrote:
>> I would be happily accepting splitting the current autopar pass
>> that way, that is, do
>>
>> NEXT_PASS (pass_parallelize_loops)
>> PUSH_INSERT_PASSES_WITHIN (pass_parallelize_loops)
>> NEXT_PASS (pass_expand_omp)
>> POP_INSERT_PASSES ()
>>
>> and make the analysis code handle lowered OMP form.
>>
>
> To explore that, I created a tentative patch on top of the gomp-4_0-branch,
> which allows a non-bootstrap build and a gcc dg.exp run, so at least a couple of
> parloops test-cases. I can put this through bootstrap and reg-test if you
> confirm this patch is what you want.
>
> I'm not sure though OACC and autopar can share the actual function split-off.
> autopar is run rather late, later than the lto-stream point, while we need the
> split-off done before that for oacc. I'm also not sure what the point would be
> to have lowered OMP form in all those passes in between, I'd think you want to
> omp-expand it asap.

Richard,

This patch implements your proposal. It uses pass_expand_omp after 
pass_parallelize_loops to expand the omp constructs inserted by 
pass_parallelize_loops.

Note: the patch doesn't remove omp_expand_local, since I'm still using that in 
my oacc kernels directive patch series.

Bootstrapped and reg-tested on x86_64.

OK for trunk?

Thanks,
- Tom

[-- Attachment #2: 0002-Run-pass_expand_omp_ssa-after-pass_paralellize_loops.patch --]
[-- Type: text/x-patch, Size: 5609 bytes --]

2014-11-12  Tom de Vries  <tom@codesourcery.com>

	* function.h (struct function): Add omp_expand_needed field.
	* omp-low.c (pass_data pass_data_expand_omp_ssa): New pass_data.
	(class pass_expand_omp_ssa): New pass.
	(make_pass_expand_omp_ssa): New function.
	* passes.def (pass_parallelize_loops): Use PUSH_INSERT_PASSES_WITHIN
	instead of NEXT_PASS.
	(pass_expand_omp_ssa): Add after pass_parallelize_loops.
	* tree-parloops.c (gen_parallel_loop): Remove call to omp_expand_local.
	(pass_parallelize_loops::execute): Don't do cleanups TODO_cleanup_cfg
	and TODO_rebuild_alias yet.  Add TODO_update_ssa.  Set
	cfun->omp_expand_needed.
	* tree-pass.h (make_pass_expand_omp_ssa): Declare.
---
 gcc/function.h      |  3 +++
 gcc/omp-low.c       | 42 ++++++++++++++++++++++++++++++++++++++++++
 gcc/passes.def      |  3 +++
 gcc/tree-parloops.c | 18 +++++++-----------
 gcc/tree-pass.h     |  1 +
 5 files changed, 56 insertions(+), 11 deletions(-)

diff --git a/gcc/function.h b/gcc/function.h
index 3a6305c..1afce69 100644
--- a/gcc/function.h
+++ b/gcc/function.h
@@ -667,6 +667,9 @@ struct GTY(()) function {
 
   /* Set when the tail call has been identified.  */
   unsigned int tail_call_marked : 1;
+
+  /* Set when an omp_expand is needed.  */
+  unsigned int omp_expand_needed : 1;
 };
 
 /* Add the decl D to the local_decls list of FUN.  */
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 5210de1..b748ee1 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -8832,6 +8832,48 @@ make_pass_expand_omp (gcc::context *ctxt)
 {
   return new pass_expand_omp (ctxt);
 }
+
+namespace {
+
+const pass_data pass_data_expand_omp_ssa =
+{
+  GIMPLE_PASS, /* type */
+  "ompexpssa", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  TV_NONE, /* tv_id */
+  PROP_cfg | PROP_ssa, /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  TODO_cleanup_cfg | TODO_rebuild_alias, /* todo_flags_finish */
+};
+
+class pass_expand_omp_ssa : public gimple_opt_pass
+{
+public:
+  pass_expand_omp_ssa (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_expand_omp_ssa, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  virtual bool gate (function *) { return (bool)cfun->omp_expand_needed; }
+
+  virtual unsigned int execute (function *)
+    {
+      unsigned res = execute_expand_omp ();
+      cfun->omp_expand_needed = 0;
+      return res;
+    }
+
+}; // class pass_expand_omp_ssa
+
+} // anon namespace
+
+gimple_opt_pass *
+make_pass_expand_omp_ssa (gcc::context *ctxt)
+{
+  return new pass_expand_omp_ssa (ctxt);
+}
 \f
 /* Routines to lower OpenMP directives into OMP-GIMPLE.  */
 
diff --git a/gcc/passes.def b/gcc/passes.def
index 2305d67..dd91718 100644
--- a/gcc/passes.def
+++ b/gcc/passes.def
@@ -241,6 +241,9 @@ along with GCC; see the file COPYING3.  If not see
 	  POP_INSERT_PASSES ()
 	  NEXT_PASS (pass_iv_canon);
 	  NEXT_PASS (pass_parallelize_loops);
+	  PUSH_INSERT_PASSES_WITHIN (pass_parallelize_loops)
+	  NEXT_PASS (pass_expand_omp_ssa);
+	  POP_INSERT_PASSES ()
 	  NEXT_PASS (pass_if_conversion);
 	  /* pass_vectorize must immediately follow pass_if_conversion.
 	     Please do not add any other passes in between.  */
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index 09b3f16..c5e3041 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -1753,7 +1753,6 @@ gen_parallel_loop (struct loop *loop,
   tree many_iterations_cond, type, nit;
   tree arg_struct, new_arg_struct;
   gimple_seq stmts;
-  basic_block parallel_head;
   edge entry, exit;
   struct clsn_data clsn_data;
   unsigned prob;
@@ -1891,8 +1890,8 @@ gen_parallel_loop (struct loop *loop,
   cond_stmt = last_stmt (loop->header);
   if (cond_stmt)
     loc = gimple_location (cond_stmt);
-  parallel_head = create_parallel_loop (loop, create_loop_fn (loc), arg_struct,
-					new_arg_struct, n_threads, loc);
+  create_parallel_loop (loop, create_loop_fn (loc), arg_struct,
+			new_arg_struct, n_threads, loc);
   if (reduction_list->elements () > 0)
     create_call_for_reduction (loop, reduction_list, &clsn_data);
 
@@ -1906,13 +1905,6 @@ gen_parallel_loop (struct loop *loop,
      removed statements.  */
   FOR_EACH_LOOP (loop, 0)
     free_numbers_of_iterations_estimates_loop (loop);
-
-  /* Expand the parallel constructs.  We do it directly here instead of running
-     a separate expand_omp pass, since it is more efficient, and less likely to
-     cause troubles with further analyses not being able to deal with the
-     OMP trees.  */
-
-  omp_expand_local (parallel_head);
 }
 
 /* Returns true when LOOP contains vector phi nodes.  */
@@ -2284,7 +2276,11 @@ pass_parallelize_loops::execute (function *fun)
     return 0;
 
   if (parallelize_loops ())
-    return TODO_cleanup_cfg | TODO_rebuild_alias;
+    {
+      fun->omp_expand_needed = 1;
+      return TODO_update_ssa;
+    }
+
   return 0;
 }
 
diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
index a3efdd8..d68979f 100644
--- a/gcc/tree-pass.h
+++ b/gcc/tree-pass.h
@@ -399,6 +399,7 @@ extern gimple_opt_pass *make_pass_lower_vector_ssa (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_lower_omp (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_diagnose_omp_blocks (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_expand_omp (gcc::context *ctxt);
+extern gimple_opt_pass *make_pass_expand_omp_ssa (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_object_sizes (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_strlen (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_fold_builtins (gcc::context *ctxt);
-- 
1.9.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Run pass_expand_omp_ssa after pass_paralellize_loops
  2014-11-12 13:16             ` Run pass_expand_omp_ssa after pass_paralellize_loops Tom de Vries
@ 2014-11-12 14:15               ` David Malcolm
  2014-11-12 14:24               ` Richard Biener
  1 sibling, 0 replies; 5+ messages in thread
From: David Malcolm @ 2014-11-12 14:15 UTC (permalink / raw)
  To: Tom de Vries
  Cc: Richard Biener, Jakub Jelinek, GCC Patches, Thomas Schwinge,
	Bernd Schmidt

On Wed, 2014-11-12 at 14:16 +0100, Tom de Vries wrote:

I can't speak to the rest of the patch, but one readability nitpick:

> diff --git a/gcc/passes.def b/gcc/passes.def
> index 2305d67..dd91718 100644
> --- a/gcc/passes.def
> +++ b/gcc/passes.def
> @@ -241,6 +241,9 @@ along with GCC; see the file COPYING3.  If not see
>           POP_INSERT_PASSES ()
>           NEXT_PASS (pass_iv_canon);
>           NEXT_PASS (pass_parallelize_loops);
> +         PUSH_INSERT_PASSES_WITHIN (pass_parallelize_loops)
> +         NEXT_PASS (pass_expand_omp_ssa);
> +         POP_INSERT_PASSES ()

Please can you add an indentation level within the PUSH/POP pair, giving
something like this?

+         PUSH_INSERT_PASSES_WITHIN (pass_parallelize_loops)
+             NEXT_PASS (pass_expand_omp_ssa);
+         POP_INSERT_PASSES ()
 
(the rest of the file is using 4 spaces worth of indentation for each
nesting level, tabifying multiples of 8)

Thanks
Dave

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Run pass_expand_omp_ssa after pass_paralellize_loops
  2014-11-12 13:16             ` Run pass_expand_omp_ssa after pass_paralellize_loops Tom de Vries
  2014-11-12 14:15               ` David Malcolm
@ 2014-11-12 14:24               ` Richard Biener
  2014-11-12 18:46                 ` Tom de Vries
  1 sibling, 1 reply; 5+ messages in thread
From: Richard Biener @ 2014-11-12 14:24 UTC (permalink / raw)
  To: Tom de Vries; +Cc: Jakub Jelinek, GCC Patches, Thomas Schwinge, Bernd Schmidt

On Wed, 12 Nov 2014, Tom de Vries wrote:

> [ moved from gcc@ to gcc-patches@ ]
> [ subject was: Re: [gomp4] openacc kernels directive support ]
> On 30-09-14 15:37, Tom de Vries wrote:
> > > I would be happily accepting splitting the current autopar pass
> > > that way, that is, do
> > > 
> > > NEXT_PASS (pass_parallelize_loops)
> > > PUSH_INSERT_PASSES_WITHIN (pass_parallelize_loops)
> > > NEXT_PASS (pass_expand_omp)
> > > POP_INSERT_PASSES ()
> > > 
> > > and make the analysis code handle lowered OMP form.
> > > 
> > 
> > To explore that, I created a tentative patch on top of the gomp-4_0-branch,
> > which allows a non-bootstrap build and a gcc dg.exp run, so at least a
> > couple of
> > parloops test-cases. I can put this through bootstrap and reg-test if you
> > confirm this patch is what you want.
> > 
> > I'm not sure though OACC and autopar can share the actual function
> > split-off.
> > autopar is run rather late, later than the lto-stream point, while we need
> > the
> > split-off done before that for oacc. I'm also not sure what the point would
> > be
> > to have lowered OMP form in all those passes in between, I'd think you want
> > to
> > omp-expand it asap.
> 
> Richard,
> 
> This patch implements your proposal. It uses pass_expand_omp after
> pass_parallelize_loops to expand the omp constructs inserted by
> pass_parallelize_loops.
> 
> Note: the patch doesn't remove omp_expand_local, since I'm still using that in
> my oacc kernels directive patch series.
> 
> Bootstrapped and reg-tested on x86_64.
> 
> OK for trunk?

Hmm, we have used properties to communicate this kind of lowering
need in the past.  So I would prefer you introduce

#define PROP_gimple_eomp (1 << 13)      /* no OpenMP directives */

provide that property by the omp expansion pass, clear it from
parloops and gate the omp expand pass if the property is already set.

Look at how PROP_gimple_lcx is handled.

Thanks,
Richard.

> Thanks,
> - Tom
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendoerffer, HRB 21284
(AG Nuernberg)
Maxfeldstrasse 5, 90409 Nuernberg, Germany

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Run pass_expand_omp_ssa after pass_paralellize_loops
  2014-11-12 14:24               ` Richard Biener
@ 2014-11-12 18:46                 ` Tom de Vries
  2014-11-13  9:13                   ` Richard Biener
  0 siblings, 1 reply; 5+ messages in thread
From: Tom de Vries @ 2014-11-12 18:46 UTC (permalink / raw)
  To: Richard Biener
  Cc: Jakub Jelinek, GCC Patches, Thomas Schwinge, Bernd Schmidt,
	David Malcolm

[-- Attachment #1: Type: text/plain, Size: 2255 bytes --]

On 12-11-14 15:17, Richard Biener wrote:
> On Wed, 12 Nov 2014, Tom de Vries wrote:
>
>> [ moved from gcc@ to gcc-patches@ ]
>> [ subject was: Re: [gomp4] openacc kernels directive support ]
>> On 30-09-14 15:37, Tom de Vries wrote:
>>>> I would be happily accepting splitting the current autopar pass
>>>> that way, that is, do
>>>>
>>>> NEXT_PASS (pass_parallelize_loops)
>>>> PUSH_INSERT_PASSES_WITHIN (pass_parallelize_loops)
>>>> NEXT_PASS (pass_expand_omp)
>>>> POP_INSERT_PASSES ()
>>>>
>>>> and make the analysis code handle lowered OMP form.
>>>>
>>>
>>> To explore that, I created a tentative patch on top of the gomp-4_0-branch,
>>> which allows a non-bootstrap build and a gcc dg.exp run, so at least a
>>> couple of
>>> parloops test-cases. I can put this through bootstrap and reg-test if you
>>> confirm this patch is what you want.
>>>
>>> I'm not sure though OACC and autopar can share the actual function
>>> split-off.
>>> autopar is run rather late, later than the lto-stream point, while we need
>>> the
>>> split-off done before that for oacc. I'm also not sure what the point would
>>> be
>>> to have lowered OMP form in all those passes in between, I'd think you want
>>> to
>>> omp-expand it asap.
>>
>> Richard,
>>
>> This patch implements your proposal. It uses pass_expand_omp after
>> pass_parallelize_loops to expand the omp constructs inserted by
>> pass_parallelize_loops.
>>
>> Note: the patch doesn't remove omp_expand_local, since I'm still using that in
>> my oacc kernels directive patch series.
>>
>> Bootstrapped and reg-tested on x86_64.
>>
>> OK for trunk?
>
> Hmm, we have used properties to communicate this kind of lowering
> need in the past.  So I would prefer you introduce
>
> #define PROP_gimple_eomp (1 << 13)      /* no OpenMP directives */
>
> provide that property by the omp expansion pass, clear it from
> parloops and gate the omp expand pass if the property is already set.
>
> Look at how PROP_gimple_lcx is handled.
>

Richard,

I've followed up on your (and David's indentation) comment.

The patch now defines a property PROP_gimple_eomp, and uses it to communicate 
the need for expansion of omp constructs between passes.

Bootstrapped and regtested on x86_64.

OK for trunk?

Thanks,
- Tom


[-- Attachment #2: 0002-Run-pass_expand_omp_ssa-after-pass_paralellize_loops.patch --]
[-- Type: text/x-patch, Size: 6806 bytes --]

2014-11-12  Tom de Vries  <tom@codesourcery.com>

	* omp-low.c (pass_data_expand_omp): Set properties_provided to
	PROP_gimple_eomp.
	(pass_expand_omp::gate): Remove function.  Move gate expression to ...
	(pass_expand_omp::execute): ... here, as new variable gate.  Add early
	exit if gate is false.
	(pass_data pass_data_expand_omp_ssa): New pass_data.
	(class pass_expand_omp_ssa): New pass.
	(make_pass_expand_omp_ssa): New function.
	* passes.def (pass_parallelize_loops): Use PUSH_INSERT_PASSES_WITHIN
	instead of NEXT_PASS.
	(pass_expand_omp_ssa): Add after pass_parallelize_loops.
	* tree-parloops.c (gen_parallel_loop): Remove call to omp_expand_local.
	(pass_parallelize_loops::execute): Don't do cleanups TODO_cleanup_cfg
	and TODO_rebuild_alias yet.  Add TODO_update_ssa.  Set
	cfun->omp_expand_needed.
	* tree-pass.h: Add define PROP_gimple_eomp.
	(make_pass_expand_omp_ssa): Declare.
---
 gcc/omp-low.c       | 56 +++++++++++++++++++++++++++++++++++++++++++++++------
 gcc/passes.def      |  3 +++
 gcc/tree-parloops.c | 18 +++++++----------
 gcc/tree-pass.h     |  2 ++
 4 files changed, 62 insertions(+), 17 deletions(-)

diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 5210de1..3afc138 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -8801,7 +8801,7 @@ const pass_data pass_data_expand_omp =
   OPTGROUP_NONE, /* optinfo_flags */
   TV_NONE, /* tv_id */
   PROP_gimple_any, /* properties_required */
-  0, /* properties_provided */
+  PROP_gimple_eomp, /* properties_provided */
   0, /* properties_destroyed */
   0, /* todo_flags_start */
   0, /* todo_flags_finish */
@@ -8815,13 +8815,18 @@ public:
   {}
 
   /* opt_pass methods: */
-  virtual bool gate (function *)
+  virtual unsigned int execute (function *)
     {
-      return ((flag_openmp != 0 || flag_openmp_simd != 0
-	       || flag_cilkplus != 0) && !seen_error ());
-    }
+      bool gate = ((flag_openmp != 0 || flag_openmp_simd != 0
+		    || flag_cilkplus != 0) && !seen_error ());
 
-  virtual unsigned int execute (function *) { return execute_expand_omp (); }
+      /* This pass always runs, to provide PROP_gimple_eomp.
+	 But there is nothing to do unless -fopenmp is given.  */
+      if (!gate)
+	return 0;
+
+      return execute_expand_omp ();
+    }
 
 }; // class pass_expand_omp
 
@@ -8832,6 +8837,45 @@ make_pass_expand_omp (gcc::context *ctxt)
 {
   return new pass_expand_omp (ctxt);
 }
+
+namespace {
+
+const pass_data pass_data_expand_omp_ssa =
+{
+  GIMPLE_PASS, /* type */
+  "ompexpssa", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  TV_NONE, /* tv_id */
+  PROP_cfg | PROP_ssa, /* properties_required */
+  PROP_gimple_eomp, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  TODO_cleanup_cfg | TODO_rebuild_alias, /* todo_flags_finish */
+};
+
+class pass_expand_omp_ssa : public gimple_opt_pass
+{
+public:
+  pass_expand_omp_ssa (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_expand_omp_ssa, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  virtual bool gate (function *fun)
+    {
+      return !(fun->curr_properties & PROP_gimple_eomp);
+    }
+  virtual unsigned int execute (function *) { return execute_expand_omp (); }
+
+}; // class pass_expand_omp_ssa
+
+} // anon namespace
+
+gimple_opt_pass *
+make_pass_expand_omp_ssa (gcc::context *ctxt)
+{
+  return new pass_expand_omp_ssa (ctxt);
+}
 \f
 /* Routines to lower OpenMP directives into OMP-GIMPLE.  */
 
diff --git a/gcc/passes.def b/gcc/passes.def
index 2305d67..ebd2b95 100644
--- a/gcc/passes.def
+++ b/gcc/passes.def
@@ -241,6 +241,9 @@ along with GCC; see the file COPYING3.  If not see
 	  POP_INSERT_PASSES ()
 	  NEXT_PASS (pass_iv_canon);
 	  NEXT_PASS (pass_parallelize_loops);
+	  PUSH_INSERT_PASSES_WITHIN (pass_parallelize_loops)
+	      NEXT_PASS (pass_expand_omp_ssa);
+	  POP_INSERT_PASSES ()
 	  NEXT_PASS (pass_if_conversion);
 	  /* pass_vectorize must immediately follow pass_if_conversion.
 	     Please do not add any other passes in between.  */
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index 09b3f16..e5dca78 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -1753,7 +1753,6 @@ gen_parallel_loop (struct loop *loop,
   tree many_iterations_cond, type, nit;
   tree arg_struct, new_arg_struct;
   gimple_seq stmts;
-  basic_block parallel_head;
   edge entry, exit;
   struct clsn_data clsn_data;
   unsigned prob;
@@ -1891,8 +1890,8 @@ gen_parallel_loop (struct loop *loop,
   cond_stmt = last_stmt (loop->header);
   if (cond_stmt)
     loc = gimple_location (cond_stmt);
-  parallel_head = create_parallel_loop (loop, create_loop_fn (loc), arg_struct,
-					new_arg_struct, n_threads, loc);
+  create_parallel_loop (loop, create_loop_fn (loc), arg_struct,
+			new_arg_struct, n_threads, loc);
   if (reduction_list->elements () > 0)
     create_call_for_reduction (loop, reduction_list, &clsn_data);
 
@@ -1906,13 +1905,6 @@ gen_parallel_loop (struct loop *loop,
      removed statements.  */
   FOR_EACH_LOOP (loop, 0)
     free_numbers_of_iterations_estimates_loop (loop);
-
-  /* Expand the parallel constructs.  We do it directly here instead of running
-     a separate expand_omp pass, since it is more efficient, and less likely to
-     cause troubles with further analyses not being able to deal with the
-     OMP trees.  */
-
-  omp_expand_local (parallel_head);
 }
 
 /* Returns true when LOOP contains vector phi nodes.  */
@@ -2284,7 +2276,11 @@ pass_parallelize_loops::execute (function *fun)
     return 0;
 
   if (parallelize_loops ())
-    return TODO_cleanup_cfg | TODO_rebuild_alias;
+    {
+      fun->curr_properties &= ~(PROP_gimple_eomp);
+      return TODO_update_ssa;
+    }
+
   return 0;
 }
 
diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
index a3efdd8..25ff364 100644
--- a/gcc/tree-pass.h
+++ b/gcc/tree-pass.h
@@ -220,6 +220,7 @@ protected:
 #define PROP_gimple_lcx		(1 << 10)       /* lowered complex */
 #define PROP_loops		(1 << 11)	/* preserve loop structures */
 #define PROP_gimple_lvec	(1 << 12)       /* lowered vector */
+#define PROP_gimple_eomp	(1 << 13)       /* no OpenMP directives */
 
 #define PROP_trees \
   (PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh | PROP_gimple_lomp)
@@ -399,6 +400,7 @@ extern gimple_opt_pass *make_pass_lower_vector_ssa (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_lower_omp (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_diagnose_omp_blocks (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_expand_omp (gcc::context *ctxt);
+extern gimple_opt_pass *make_pass_expand_omp_ssa (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_object_sizes (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_strlen (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_fold_builtins (gcc::context *ctxt);
-- 
1.9.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Run pass_expand_omp_ssa after pass_paralellize_loops
  2014-11-12 18:46                 ` Tom de Vries
@ 2014-11-13  9:13                   ` Richard Biener
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Biener @ 2014-11-13  9:13 UTC (permalink / raw)
  To: Tom de Vries
  Cc: Jakub Jelinek, GCC Patches, Thomas Schwinge, Bernd Schmidt,
	David Malcolm

On Wed, 12 Nov 2014, Tom de Vries wrote:

> On 12-11-14 15:17, Richard Biener wrote:
> > On Wed, 12 Nov 2014, Tom de Vries wrote:
> > 
> > > [ moved from gcc@ to gcc-patches@ ]
> > > [ subject was: Re: [gomp4] openacc kernels directive support ]
> > > On 30-09-14 15:37, Tom de Vries wrote:
> > > > > I would be happily accepting splitting the current autopar pass
> > > > > that way, that is, do
> > > > > 
> > > > > NEXT_PASS (pass_parallelize_loops)
> > > > > PUSH_INSERT_PASSES_WITHIN (pass_parallelize_loops)
> > > > > NEXT_PASS (pass_expand_omp)
> > > > > POP_INSERT_PASSES ()
> > > > > 
> > > > > and make the analysis code handle lowered OMP form.
> > > > > 
> > > > 
> > > > To explore that, I created a tentative patch on top of the
> > > > gomp-4_0-branch,
> > > > which allows a non-bootstrap build and a gcc dg.exp run, so at least a
> > > > couple of
> > > > parloops test-cases. I can put this through bootstrap and reg-test if
> > > > you
> > > > confirm this patch is what you want.
> > > > 
> > > > I'm not sure though OACC and autopar can share the actual function
> > > > split-off.
> > > > autopar is run rather late, later than the lto-stream point, while we
> > > > need
> > > > the
> > > > split-off done before that for oacc. I'm also not sure what the point
> > > > would
> > > > be
> > > > to have lowered OMP form in all those passes in between, I'd think you
> > > > want
> > > > to
> > > > omp-expand it asap.
> > > 
> > > Richard,
> > > 
> > > This patch implements your proposal. It uses pass_expand_omp after
> > > pass_parallelize_loops to expand the omp constructs inserted by
> > > pass_parallelize_loops.
> > > 
> > > Note: the patch doesn't remove omp_expand_local, since I'm still using
> > > that in
> > > my oacc kernels directive patch series.
> > > 
> > > Bootstrapped and reg-tested on x86_64.
> > > 
> > > OK for trunk?
> > 
> > Hmm, we have used properties to communicate this kind of lowering
> > need in the past.  So I would prefer you introduce
> > 
> > #define PROP_gimple_eomp (1 << 13)      /* no OpenMP directives */
> > 
> > provide that property by the omp expansion pass, clear it from
> > parloops and gate the omp expand pass if the property is already set.
> > 
> > Look at how PROP_gimple_lcx is handled.
> > 
> 
> Richard,
> 
> I've followed up on your (and David's indentation) comment.
> 
> The patch now defines a property PROP_gimple_eomp, and uses it to communicate
> the need for expansion of omp constructs between passes.
> 
> Bootstrapped and regtested on x86_64.
> 
> OK for trunk?

Ok.

Thanks,
Richard.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-11-13  9:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <53E24570.1010200@mentor.com>
     [not found] ` <53F1EEB7.1090509@mentor.com>
     [not found]   ` <540ED665.3010003@mentor.com>
     [not found]     ` <alpine.LSU.2.11.1409091243220.20733@zhemvz.fhfr.qr>
     [not found]       ` <54185877.6020902@mentor.com>
     [not found]         ` <alpine.LSU.2.11.1409221019590.20733@zhemvz.fhfr.qr>
     [not found]           ` <542AB218.5060502@mentor.com>
2014-11-12 13:16             ` Run pass_expand_omp_ssa after pass_paralellize_loops Tom de Vries
2014-11-12 14:15               ` David Malcolm
2014-11-12 14:24               ` Richard Biener
2014-11-12 18:46                 ` Tom de Vries
2014-11-13  9:13                   ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).