[OPENMP]Do not add TGT_OMP_TARGET_PARAM flag to non-captured mapped arguments.
authorAlexey Bataev <a.bataev@hotmail.com>
Tue, 11 Aug 2020 16:30:45 +0000 (12:30 -0400)
committerAlexey Bataev <a.bataev@hotmail.com>
Wed, 12 Aug 2020 14:06:52 +0000 (10:06 -0400)
commitddbd21d288f6ff7d175f18ddee0ee6407626445a
treede5d446477600a1323c32e30c0dcaa93e6cd2069
parente14474a39a14b3c86c6c5d5ed9bf11467a0bbe9b
[OPENMP]Do not add TGT_OMP_TARGET_PARAM flag to non-captured mapped arguments.

If the arguments are mapped, but are actually not used in the target
region, the compiler still adds attribute TGT_OMP_TARGET_PARAM for such
arguments. It makes the libomptarget to add such parameters to the list
of arguments, passed to the kernel at the runtime, and may lead to
incorrect results/crashes during execution.

Differential Revision: https://reviews.llvm.org/D85755
clang/lib/CodeGen/CGOpenMPRuntime.cpp
clang/test/OpenMP/target_map_codegen_18.inc
clang/test/OpenMP/target_map_codegen_20.cpp
clang/test/OpenMP/target_map_codegen_31.cpp
clang/test/OpenMP/target_map_codegen_32.cpp
clang/test/OpenMP/target_teams_map_codegen.cpp