This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][2/3][PR65458] Mark omp thread functions as parallelized


Hi,

this patch fixes PR65458.

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

Bootstrapped and reg-tested on x86_64.

OK for stage4 trunk?

Thanks,
- Tom
Mark omp thread functions as parallelized

2015-03-18  Tom de Vries  <tom@codesourcery.com>

	PR tree-optimization/65458
	* omp-low.c: Add include of tree-parloops.h.
	(expand_omp_taskreg): Call mark_parallelized_function for child_fn.
	* tree-parloops.c (mark_parallelized_function): New function.  Factor
	out of ..
	(create_loop_fn): ... here.
	* tree-parloops.h (mark_parallelized_function): Declare.
---
 gcc/omp-low.c       |  2 ++
 gcc/tree-parloops.c | 14 ++++++++++----
 gcc/tree-parloops.h |  1 +
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 48d73cb..c5c0ccf 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -108,6 +108,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "context.h"
 #include "lto-section-names.h"
 #include "gomp-constants.h"
+#include "tree-parloops.h"
 
 
 /* Lowering of OMP parallel and workshare constructs proceeds in two
@@ -5370,6 +5371,7 @@ expand_omp_taskreg (struct omp_region *region)
   entry_stmt = last_stmt (region->entry);
   child_fn = gimple_omp_taskreg_child_fn (entry_stmt);
   child_cfun = DECL_STRUCT_FUNCTION (child_fn);
+  mark_parallelized_function (child_fn);
 
   entry_bb = region->entry;
   exit_bb = region->exit;
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index a584460..7405258 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -1439,6 +1439,16 @@ parallelized_function_p (tree fn)
   return bitmap_bit_p (parallelized_functions, DECL_UID (fn));
 }
 
+void
+mark_parallelized_function (tree fndecl)
+{
+  if (!parallelized_functions)
+    parallelized_functions = BITMAP_GGC_ALLOC ();
+
+  bitmap_set_bit (parallelized_functions, DECL_UID (fndecl));
+}
+
+
 /* Creates and returns an empty function that will receive the body of
    a parallelized loop.  */
 
@@ -1459,10 +1469,6 @@ create_loop_fn (location_t loc)
   type = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE);
 
   decl = build_decl (loc, FUNCTION_DECL, name, type);
-  if (!parallelized_functions)
-    parallelized_functions = BITMAP_GGC_ALLOC ();
-  bitmap_set_bit (parallelized_functions, DECL_UID (decl));
-
   TREE_STATIC (decl) = 1;
   TREE_USED (decl) = 1;
   DECL_ARTIFICIAL (decl) = 1;
diff --git a/gcc/tree-parloops.h b/gcc/tree-parloops.h
index d71f0a4..a742755 100644
--- a/gcc/tree-parloops.h
+++ b/gcc/tree-parloops.h
@@ -21,5 +21,6 @@ along with GCC; see the file COPYING3.  If not see
 #define GCC_TREE_PARLOOPS_H
 
 extern bool parallelized_function_p (tree);
+extern void mark_parallelized_function (tree);
 
 #endif /* GCC_TREE_PARLOOPS_H */
-- 
1.9.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]