This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gomp4, committed, 1/9] Move expansion of kernels region back to first omp-expand
- From: Tom de Vries <Tom_deVries at mentor dot com>
- To: "gcc-patches at gnu dot org" <gcc-patches at gnu dot org>
- Cc: Jakub Jelinek <jakub at redhat dot com>
- Date: Thu, 5 Nov 2015 11:33:00 +0100
- Subject: [gomp4, committed, 1/9] Move expansion of kernels region back to first omp-expand
- Authentication-results: sourceware.org; auth=none
- References: <563B2C99 dot 90308 at mentor dot com>
On 05/11/15 11:16, Tom de Vries wrote:
Hi,
now that we have committed -foffload-alias in gomp-4_0-branch (
https://gcc.gnu.org/ml/gcc-patches/2015-11/msg00214.html ), we no longer
need the kernels region to be a part of the original function when doing
alias analysis.
So, we no longer have the need to postpone splitting off the kernels
region into a seperate function until after alias analysis, but we can
do this at the same time as when we expand the parallel region.
The following patch series implements that:
1 Move expansion of kernels region back to first omp-expand
2 Update gate_oacc_kernels to handle oacc function
3 Revert "Add skip_stmt parm to pass_dominator::get_sese ()"
4 Revert "Add pass_dominator::sese_mode_p ()"
5 Handle oacc function in parloops
6 Update goacc kernels C testcases
7 Update goacc kernels Fortran testcases
8 Release_defs in expand_omp_atomic_fetch_op
9 Remove BUILT_IN_GOACC_KERNELS_INTERNAL
[ The patch series is broken up into logical bits, but intended as
single commit. Various things in kernels support will be broken in
intermediate stages. ]
Committed to gomp-4_0-branch.
I'll post the patches in reply to this message.
This patch moves expansion of the kernels region back to the first
omp-expand pass, before ssa.
There's no longer a need for the region-replacing call to expand into
BUILT_IN_GOACC_KERNELS_INTERNAL and subsequently map onto
BUILT_IN_GOACC_PARALLEL during the second omp-expand pass. The
BUILT_IN_GOACC_KERNELS_INTERNAL call was modeled transparant to alias
analysis, and that's no longer needed.
Thanks,
- Tom
Move expansion of kernels region back to first omp-expand
2015-11-04 Tom de Vries <tom@codesourcery.com>
* omp-low.c (expand_omp_target): Remove do_emit_library_call variable,
assume true. Remove do_splitoff variable, assume true. Remove
BUILT_IN_GOACC_KERNELS_INTERNAL handling. Replace kernels region with a
BUILT_IN_GOACC_PARALLEL call.
---
gcc/omp-low.c | 57 ++++-----------------------------------------------------
1 file changed, 4 insertions(+), 53 deletions(-)
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 6bac074..ac8c8d0 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -12563,8 +12563,6 @@ expand_omp_target (struct omp_region *region)
gimple *stmt;
edge e;
bool offloaded, data_region;
- bool do_emit_library_call = true;
- bool do_splitoff = true;
entry_stmt = as_a <gomp_target *> (last_stmt (region->entry));
@@ -12608,43 +12606,7 @@ expand_omp_target (struct omp_region *region)
exit_bb = region->exit;
if (gimple_omp_target_kind (entry_stmt) == GF_OMP_TARGET_KIND_OACC_KERNELS)
- {
- if (!gimple_in_ssa_p (cfun))
- {
- /* We need to do analysis and optimizations on the kernels region
- before splitoff. Since that's hard to do on low gimple, we
- postpone the splitoff until we're in SSA.
- However, we do the emit of the corresponding function call already,
- in order to keep the arguments of the call alive until the
- splitoff.
- Since at this point the function that is called is empty, we can
- model the function as BUILT_IN_GOACC_KERNELS_INTERNAL, which marks
- some of it's function arguments as non-escaping, so it acts less
- as an optimization barrier. */
- do_splitoff = false;
- cfun->curr_properties &= ~PROP_gimple_eomp;
-
- mark_loops_in_oacc_kernels_region (region->entry, region->exit);
- }
- else
- {
- /* Don't emit the library call. We've already done that. */
- do_emit_library_call = false;
- /* Transform BUILT_IN_GOACC_KERNELS_INTERNAL into
- BUILT_IN_GOACC_PARALLELL. Now that the function
- body will be split off, we can no longer regard the
- omp_data_array reference as non-escaping. */
- gsi = gsi_last_bb (entry_bb);
- gsi_prev (&gsi);
- gcall *call = as_a <gcall *> (gsi_stmt (gsi));
- gcc_assert (gimple_call_builtin_p
- (call, BUILT_IN_GOACC_KERNELS_INTERNAL));
- tree fndecl = builtin_decl_explicit (BUILT_IN_GOACC_PARALLEL);
- gimple_call_set_fndecl (call, fndecl);
- gimple_call_set_fntype (call, TREE_TYPE (fndecl));
- gimple_call_reset_alias_info (call);
- }
- }
+ mark_loops_in_oacc_kernels_region (region->entry, region->exit);
basic_block entry_succ_bb = single_succ (entry_bb);
if (offloaded && !gimple_in_ssa_p (cfun))
@@ -12654,8 +12616,7 @@ expand_omp_target (struct omp_region *region)
gsi_remove (&gsi, true);
}
- if (offloaded
- && do_splitoff)
+ if (offloaded)
{
unsigned srcidx, dstidx, num;
@@ -12852,13 +12813,6 @@ expand_omp_target (struct omp_region *region)
pop_cfun ();
}
- if (!do_emit_library_call)
- {
- if (gimple_in_ssa_p (cfun))
- update_ssa (TODO_update_ssa_only_virtuals);
- return;
- }
-
/* Emit a library call to launch the offloading region, or do data
transfers. */
tree t1, t2, t3, t4, device, cond, depend, c, clauses;
@@ -12885,10 +12839,8 @@ expand_omp_target (struct omp_region *region)
flags_i |= GOMP_TARGET_FLAG_EXIT_DATA;
break;
case GF_OMP_TARGET_KIND_OACC_PARALLEL:
- start_ix = BUILT_IN_GOACC_PARALLEL;
- break;
case GF_OMP_TARGET_KIND_OACC_KERNELS:
- start_ix = BUILT_IN_GOACC_KERNELS_INTERNAL;
+ start_ix = BUILT_IN_GOACC_PARALLEL;
break;
case GF_OMP_TARGET_KIND_OACC_DATA:
start_ix = BUILT_IN_GOACC_DATA_START;
@@ -12951,8 +12903,7 @@ expand_omp_target (struct omp_region *region)
tree tmp_var;
tmp_var = create_tmp_var (TREE_TYPE (device));
- if (offloaded
- && do_splitoff)
+ if (offloaded)
e = split_block_after_labels (new_bb);
else
{
--
1.9.1