| // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-globals all --version 5 |
| // RUN: %clang_cc1 "-triple" "nvptx64-nvidia-cuda" -emit-llvm -fcuda-is-device -o - %s | FileCheck %s |
| |
| #include "Inputs/cuda.h" |
| |
| struct S {}; |
| |
| __global__ void kernel(__grid_constant__ const S gc_arg1, int arg2, __grid_constant__ const int gc_arg3) {} |
| |
| // dependent arguments get diagnosed after instantiation. |
| template <typename T> |
| __global__ void tkernel_const(__grid_constant__ const T arg) {} |
| |
| template <typename T> |
| __global__ void tkernel(int dummy, __grid_constant__ T arg) {} |
| |
| void foo() { |
| tkernel_const<const S><<<1,1>>>({}); |
| tkernel_const<S><<<1,1>>>({}); |
| tkernel<const S><<<1,1>>>(1, {}); |
| } |
| //. |
| //. |
| // CHECK: [[META0:![0-9]+]] = !{ptr @_Z6kernel1Sii, !"grid_constant", [[META1:![0-9]+]]} |
| // CHECK: [[META1]] = !{i32 1, i32 3} |
| // CHECK: [[META2:![0-9]+]] = !{ptr @_Z13tkernel_constIK1SEvT_, !"grid_constant", [[META3:![0-9]+]]} |
| // CHECK: [[META3]] = !{i32 1} |
| // CHECK: [[META4:![0-9]+]] = !{ptr @_Z13tkernel_constI1SEvT_, !"grid_constant", [[META3]]} |
| // CHECK: [[META5:![0-9]+]] = !{ptr @_Z7tkernelIK1SEviT_, !"grid_constant", [[META6:![0-9]+]]} |
| // CHECK: [[META6]] = !{i32 2} |
| //. |