Hi,

this patch moves a bunch of early-out tests from the parloops pass to the gate function.

The only effect is for functions that we don't consider at all for parallelization in the parloops pass. We no longer dump those in the parloops dump file.

Bootstrapped and reg-tested on x86_64.

OK for stage1 trunk?

Thanks,
- Tom
2015-03-10  Tom de Vries  <t...@codesourcery.com>

	* tree-parloops.c (parallelize_loops): Move early-out tests from
	here ...
	(pass_parallelize_loops::execute): ... and here ...
	(pass_parallelize_loops::gate): ... to here.

diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index 5f7c1bc..3a80cea 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -2163,12 +2163,6 @@ parallelize_loops (void)
   HOST_WIDE_INT estimated;
   source_location loop_loc;
 
-  /* Do not parallelize loops in the functions created by parallelization.  */
-  if (parallelized_function_p (cfun->decl))
-    return false;
-  if (cfun->has_nonlocal_label)
-    return false;
-
   gcc_obstack_init (&parloop_obstack);
   reduction_info_table_type reduction_list (10);
   init_stmt_vec_info_vec ();
@@ -2286,7 +2280,15 @@ public:
   {}
 
   /* opt_pass methods: */
-  virtual bool gate (function *) { return flag_tree_parallelize_loops > 1; }
+  virtual bool gate (function *fun)
+    {
+      return (flag_tree_parallelize_loops > 1
+	      /* Do not parallelize loops in the functions created by
+		 parallelization.  */
+	      && !parallelized_function_p (fun->decl)
+	      && !fun->has_nonlocal_label
+	      && number_of_loops (fun) > 1);
+    }
   virtual unsigned int execute (function *);
 
 }; // class pass_parallelize_loops
@@ -2294,9 +2296,6 @@ public:
 unsigned
 pass_parallelize_loops::execute (function *fun)
 {
-  if (number_of_loops (fun) <= 1)
-    return 0;
-
   if (parallelize_loops ())
     {
       fun->curr_properties &= ~(PROP_gimple_eomp);
-- 
1.9.1

Reply via email to