openmp: Optimize DECL_IN_CONSTANT_POOL vars in target regions
authorJakub Jelinek <jakub@redhat.com>
Sun, 9 Feb 2020 07:17:10 +0000 (08:17 +0100)
committerJakub Jelinek <jakub@redhat.com>
Sun, 9 Feb 2020 07:17:10 +0000 (08:17 +0100)
commit9bc3b95dfefd37d860c5dc0004f8a53f6290fbb1
tree3c52ec4eaaf12982e117be6ae6dd5ed634055cbf
parenta5691173e6142b11c5d45bed073ff65bfe1f2d73
openmp: Optimize DECL_IN_CONSTANT_POOL vars in target regions

DECL_IN_CONSTANT_POOL are shared and thus don't really get emitted in the
BLOCK where they are used, so for OpenMP target regions that have initializers
gimplified into copying from them we actually map them at runtime from host to
offload devices.  This patch instead marks them as "omp declare target", so
that they are on the target device from the beginning and don't need to be
copied there.

2020-02-09  Jakub Jelinek  <jakub@redhat.com>

* gimplify.c (gimplify_adjust_omp_clauses_1): Promote
DECL_IN_CONSTANT_POOL variables into "omp declare target" to avoid
copying them around between host and target.

* testsuite/libgomp.c/target-38.c: New test.
gcc/ChangeLog
gcc/gimplify.c
libgomp/ChangeLog
libgomp/testsuite/libgomp.c/target-38.c [new file with mode: 0644]