On 09/06/15 13:07, Richard Biener wrote:
On Mon, 8 Jun 2015, Tom de Vries wrote:

On 17/04/15 12:08, Tom de Vries wrote:
On 20-03-15 12:38, Tom de Vries wrote:
On 19-03-15 12:05, Tom de Vries wrote:
On 18-03-15 18:22, Tom de Vries wrote:
Hi,

this patch fixes PR65460.

The patch marks offloaded functions as parallelized, which means the
parloops
pass no longer attempts to modify that function.

Updated patch to postpone mark_parallelized_function until the
corresponding
cgraph_node is available, to ensure it works with the updated
mark_parallelized_function from patch 2/3.


Updated to eliminate mark_parallelized_function.

Bootstrapped and reg-tested on x86_64.

OK for stage4?


ping.

ping^2. Original post at
https://gcc.gnu.org/ml/gcc-patches/2015-03/msg01063.html .

Ok, but shouldn't it be set before calling add_new_function as
add_new_function might run passes that wouldn't identify the
function as parallelized?


Hm, indeed sometimes add_new_function executes some passes itself, besides queueing the function for further processing. I suppose the existing settings of parallelized_function should be modified in a similar way.

I'll bootstrap and reg-test attached two patches on x86_64, and commit unless objections.

Thanks,
- Tom
Mark function parallelized_function before add_new_function

2015-06-09  Tom de Vries  <t...@codesourcery.com>

	* omp-low.c (finalize_task_copyfn, expand_omp_taskreg): Mark function
	parallelized_function before add_new_function.
---
 gcc/omp-low.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index f322416..2045e48 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -1552,8 +1552,9 @@ finalize_task_copyfn (gomp_task *task_stmt)
   pop_cfun ();
 
   /* Inform the callgraph about the new function.  */
+  cgraph_node *node = cgraph_node::get_create (child_fn);
+  node->parallelized_function = 1;
   cgraph_node::add_new_function (child_fn, false);
-  cgraph_node::get (child_fn)->parallelized_function = 1;
 }
 
 /* Destroy a omp_context data structures.  Called through the splay tree
@@ -5589,8 +5590,9 @@ expand_omp_taskreg (struct omp_region *region)
 
       /* Inform the callgraph about the new function.  */
       DECL_STRUCT_FUNCTION (child_fn)->curr_properties = cfun->curr_properties;
+      cgraph_node *node = cgraph_node::get_create (child_fn);
+      node->parallelized_function = 1;
       cgraph_node::add_new_function (child_fn, true);
-      cgraph_node::get (child_fn)->parallelized_function = 1;
 
       /* Fix the callgraph edges for child_cfun.  Those for cfun will be
 	 fixed in a following pass.  */
-- 
1.9.1

Mark offloaded functions as parallelized

2015-06-09  Tom de Vries  <t...@codesourcery.com>

	PR tree-optimization/65460
	* omp-low.c (expand_omp_target): Set parallelized_function on
	cgraph_node for child_fn.
---
 gcc/omp-low.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 2045e48..77716bf6 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -8959,6 +8959,8 @@ expand_omp_target (struct omp_region *region)
 
       /* Inform the callgraph about the new function.  */
       DECL_STRUCT_FUNCTION (child_fn)->curr_properties = cfun->curr_properties;
+      cgraph_node *node = cgraph_node::get_create (child_fn);
+      node->parallelized_function = 1;
       cgraph_node::add_new_function (child_fn, true);
 
 #ifdef ENABLE_OFFLOADING
-- 
1.9.1

Reply via email to