1 // Tests CUDA kernel arguments get copied by value when targeting SPIR-V, even with 2 // destructor, copy constructor or move constructor defined by user. 3 4 // RUN: %clang -emit-llvm --cuda-device-only --offload=spirv32 \ 5 // RUN: -nocudalib -nocudainc %s -o %t.bc -c 2>&1 6 // RUN: llvm-dis %t.bc -o %t.ll 7 // RUN: FileCheck %s --input-file=%t.ll 8 9 // RUN: %clang -emit-llvm --cuda-device-only --offload=spirv64 \ 10 // RUN: -nocudalib -nocudainc %s -o %t.bc -c 2>&1 11 // RUN: llvm-dis %t.bc -o %t.ll 12 // RUN: FileCheck %s --input-file=%t.ll 13 14 class GpuData { 15 public: GpuData(int * src)16 __attribute__((host)) __attribute__((device)) GpuData(int* src) {} ~GpuData()17 __attribute__((host)) __attribute__((device)) ~GpuData() {} GpuData(const GpuData & other)18 __attribute__((host)) __attribute__((device)) GpuData(const GpuData& other) {} GpuData(GpuData && other)19 __attribute__((host)) __attribute__((device)) GpuData(GpuData&& other) {} 20 }; 21 22 // CHECK: define 23 // CHECK-SAME: spir_kernel void @_Z6kernel7GpuData(ptr noundef byval(%class.GpuData) align 24 kernel(GpuData output)25__attribute__((global)) void kernel(GpuData output) {} 26