[CUDA] Fix static device variables with -fgpu-rdc
authorJonas Hahnfeld <jonas.hahnfeld@cern.ch>
Fri, 20 Aug 2021 11:28:37 +0000 (13:28 +0200)
committerJonas Hahnfeld <jonas.hahnfeld@cern.ch>
Wed, 25 Aug 2021 07:31:22 +0000 (09:31 +0200)
commitea08c4cd1c0869ec5024a8bb3f5cdf06ab03ae83
tree60bd75ba846d63d70c8c3d41dbd18cf8951de77f
parent5fc4828aa6c6df03bd98b1f066e85655383d0cce
[CUDA] Fix static device variables with -fgpu-rdc

NVPTX does not allow dots in the identifier, so ptxas errors out with
   fatal   : Parsing error near '.static': syntax error
because it parses .static as a directive. Avoid this problem by using
two underscores, similar to what OpenMP does for outlined functions.

Differential Revision: https://reviews.llvm.org/D108456
clang/lib/CodeGen/CodeGenModule.cpp
clang/test/CodeGenCUDA/device-var-linkage.cu
clang/test/CodeGenCUDA/managed-var.cu
clang/test/CodeGenCUDA/static-device-var-rdc.cu