Hi!

On Wed, 12 Mar 2014 14:48:03 +0100, I wrote:
> On Wed, 4 Sep 2013 20:54:47 +0200, Jakub Jelinek <ja...@redhat.com> wrote:
> > This patch implements #pragma omp {target{, data, update},teams} lowering
> > and expansion, and adds stub calls into libgomp, so that (for now
> > unconditionally) we can at least always fall back to host execution.
> 
> > 2013-09-04  Jakub Jelinek  <ja...@redhat.com>
> 
> >     * omp-low.c [...]
> >     (create_omp_child_function): If current function has
> >     "omp declare target" attribute or if current region
> >     is OMP_TARGET or lexically nested in it, add that
> >     attribute to the omp child function.
> 
> It seems that I have missed this one when generalizing the existing code
> for OpenACC: [...]

> Even if not yet relevant at the moment for OpenACC, I think it makes
> sense to make it more obvious, and change the code as follows.  Will
> commit soon unless someone disagrees.

Committed to gomp-4_0-branch in r208531:

commit d50387c6b64d888e2acf12088979e6147bdaccc9
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Thu Mar 13 07:53:48 2014 +0000

    Properly detect all offloaded regions.
    
        gcc/
        * omp-low.c (create_omp_child_function): Use
        is_gimple_omp_offloaded when looking for offloaded regions.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@208531 
138bc75d-0d04-0410-961f-82ee72b054a4

diff --git gcc/ChangeLog.gomp gcc/ChangeLog.gomp
index 4ee843f..5fb4657 100644
--- gcc/ChangeLog.gomp
+++ gcc/ChangeLog.gomp
@@ -1,3 +1,8 @@
+2014-03-13  Thomas Schwinge  <tho...@codesourcery.com>
+
+       * omp-low.c (create_omp_child_function): Use
+       is_gimple_omp_offloaded when looking for offloaded regions.
+
 2014-03-12  Thomas Schwinge  <tho...@codesourcery.com>
 
        * omp-low.c (scan_sharing_clauses): Move offloaded logic into...
diff --git gcc/omp-low.c gcc/omp-low.c
index 6b676e5..aa2dd32 100644
--- gcc/omp-low.c
+++ gcc/omp-low.c
@@ -1978,16 +1978,12 @@ create_omp_child_function (omp_context *ctx, bool 
task_copy)
     {
       omp_context *octx;
       for (octx = ctx; octx; octx = octx->outer)
-       if (gimple_code (octx->stmt) == GIMPLE_OMP_TARGET
-           && gimple_omp_target_kind (octx->stmt)
-              == GF_OMP_TARGET_KIND_REGION)
+       if (is_gimple_omp_offloaded (octx->stmt))
          {
            target_p = true;
            break;
          }
     }
-  gcc_assert (!is_gimple_omp_oacc_specifically (ctx->stmt)
-             || !target_p);
   if (target_p)
     DECL_ATTRIBUTES (decl)
       = tree_cons (get_identifier ("omp declare target"),


Grüße,
 Thomas

Attachment: pgpXkcy1cagp4.pgp
Description: PGP signature

Reply via email to