[libomptarget][nvptx] Undef, weak shared variables
authorJonChesterfield <jonathanchesterfield@gmail.com>
Wed, 28 Oct 2020 14:22:27 +0000 (14:22 +0000)
committerJon Chesterfield <jonathanchesterfield@gmail.com>
Wed, 28 Oct 2020 14:25:36 +0000 (14:25 +0000)
commit5d02ca49a294848b533adf7dc1d1275d125ef587
tree166a2d8e4d28fd2831bdbc1449e12ab0188a2966
parentafc44efc262b27e8d6cdcf86d40a820ecd450520
[libomptarget][nvptx] Undef, weak shared variables

[libomptarget][nvptx] Undef, weak shared variables

Shared variables on nvptx, and LDS on amdgcn, are uninitialized at
the start of kernel execution. Therefore create the variables with
undef instead of zeros, motivated in part by the amdgcn back end
rejecting LDS+initializer.

Common is zero initialized, which seems incompatible with shared. Thus
change them to weak, following the direction of
https://reviews.llvm.org/rG7b3eabdcd215

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D90248
clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
clang/test/OpenMP/nvptx_data_sharing.cpp
clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
clang/test/OpenMP/nvptx_parallel_codegen.cpp
clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
clang/test/OpenMP/nvptx_target_parallel_reduction_codegen.cpp
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
clang/test/OpenMP/nvptx_teams_codegen.cpp
clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp