xref: /aosp_15_r20/external/clang/test/CodeGenCUDA/llvm-used.cu (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -emit-llvm %s -o - -fcuda-is-device -triple nvptx64-unknown-unknown | FileCheck %s
2*67e74705SXin Li 
3*67e74705SXin Li 
4*67e74705SXin Li // Make sure we emit the proper addrspacecast for llvm.used.  PR22383 exposed an
5*67e74705SXin Li // issue where we were generating a bitcast instead of an addrspacecast.
6*67e74705SXin Li 
7*67e74705SXin Li // CHECK: @llvm.used = appending global [1 x i8*] [i8* addrspacecast (i8 addrspace(1)* bitcast ([0 x i32] addrspace(1)* @a to i8 addrspace(1)*) to i8*)], section "llvm.metadata"
8*67e74705SXin Li __attribute__((device)) __attribute__((__used__)) int a[] = {};
9