diff mbox

[6/8] Add pass_ccp to pass_oacc_kernels

Message ID 54746A4F.30309@mentor.com
State New
Headers show

Commit Message

Tom de Vries Nov. 25, 2014, 11:38 a.m. UTC
On 15-11-14 18:22, Tom de Vries wrote:
> On 15-11-14 13:14, Tom de Vries wrote:
>> Hi,
>>
>> I'm submitting a patch series with initial support for the oacc kernels
>> directive.
>>
>> The patch series uses pass_parallelize_loops to implement parallelization of
>> loops in the oacc kernels region.
>>
>> The patch series consists of these 8 patches:
>> ...
>>      1  Expand oacc kernels after pass_build_ealias
>>      2  Add pass_oacc_kernels
>>      3  Add pass_ch_oacc_kernels to pass_oacc_kernels
>>      4  Add pass_tree_loop_{init,done} to pass_oacc_kernels
>>      5  Add pass_loop_im to pass_oacc_kernels
>>      6  Add pass_ccp to pass_oacc_kernels
>>      7  Add pass_parloops_oacc_kernels to pass_oacc_kernels
>>      8  Do simple omp lowering for no address taken var
>> ...
>
> This patch adds pass_loop_ccp to pass group pass_oacc_kernels.
>
> We need this pass to simplify the loop body, and allow pass_parloops to detect
> that loop iterations are independent.
>

As suggested here ( https://gcc.gnu.org/ml/gcc-patches/2014-11/msg02993.html ) 
I've replaced the pass_ccp with pass_copyprop, which performs trivial constant 
propagation in addition to copy propagation.

Bootstrapped and reg-tested as before.

OK for trunk?

Thanks,
- Tom
diff mbox

Patch

[PATCH 6/7] Add pass_copy_prop in pass_oacc_kernels

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

	* passes.def: Add pass_copy_prop to pass group pass_oacc_kernels.
	* tree-ssa-copy.c (stmt_may_generate_copy): Handle .omp_data_i init
	conservatively.
---
 gcc/passes.def      | 1 +
 gcc/tree-ssa-copy.c | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/gcc/passes.def b/gcc/passes.def
index 438d292..fb0d331 100644
--- a/gcc/passes.def
+++ b/gcc/passes.def
@@ -93,6 +93,7 @@  along with GCC; see the file COPYING3.  If not see
 	      NEXT_PASS (pass_ch_oacc_kernels);
 	      NEXT_PASS (pass_tree_loop_init);
 	      NEXT_PASS (pass_lim);
+	      NEXT_PASS (pass_copy_prop);
 	      NEXT_PASS (pass_expand_omp_ssa);
 	      NEXT_PASS (pass_tree_loop_done);
 	  POP_INSERT_PASSES ()
diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c
index 7c22c5e..d6eb7a7 100644
--- a/gcc/tree-ssa-copy.c
+++ b/gcc/tree-ssa-copy.c
@@ -55,6 +55,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree-scalar-evolution.h"
 #include "tree-ssa-dom.h"
 #include "tree-ssa-loop-niter.h"
+#include "omp-low.h"
 
 
 /* This file implements the copy propagation pass and provides a
@@ -110,6 +111,9 @@  stmt_may_generate_copy (gimple stmt)
   if (gimple_has_volatile_ops (stmt))
     return false;
 
+  if (gimple_stmt_omp_data_i_init_p (stmt))
+    return false;
+
   /* Statements with loads and/or stores will never generate a useful copy.  */
   if (gimple_vuse (stmt))
     return false;
-- 
1.9.1