// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 // REQUIRES: amdgpu-registered-target // RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -x hip -emit-llvm -fcuda-is-device -debug-info-kind=limited -gheterogeneous-dwarf -o - %s | FileCheck %s #define __device__ __attribute__((device)) #define __shared__ __attribute__((shared)) #define __constant__ __attribute__((constant)) __device__ int FileVarDevice; __device__ __shared__ int FileVarDeviceShared; __device__ __constant__ int FileVarDeviceConstant; // CHECK-LABEL: define dso_local void @_Z7kernel1i( // CHECK-SAME: i32 noundef [[ARG:%.*]]) #[[ATTR0:[0-9]+]] !dbg [[DBG13:![0-9]+]] { // CHECK-NEXT: [[ENTRY:.*:]] // CHECK-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4, addrspace(5) // CHECK-NEXT: [[FUNCVAR:%.*]] = alloca i32, align 4, addrspace(5) // CHECK-NEXT: [[ARG_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[ARG_ADDR]] to ptr // CHECK-NEXT: [[FUNCVAR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[FUNCVAR]] to ptr // CHECK-NEXT: store i32 [[ARG]], ptr [[ARG_ADDR_ASCAST]], align 4 // CHECK-NEXT: #dbg_declare(ptr addrspace(5) [[ARG_ADDR]], [[META17:![0-9]+]], !DIExpression(DIOpArg(0, ptr addrspace(5)), DIOpDeref(i32)), [[META24:![0-9]+]]) // CHECK-NEXT: #dbg_declare(ptr addrspace(5) [[FUNCVAR]], [[META18:![0-9]+]], !DIExpression(DIOpArg(0, ptr addrspace(5)), DIOpDeref(i32)), [[META25:![0-9]+]]) // CHECK-NEXT: ret void, !dbg [[DBG26:![0-9]+]] // __device__ void kernel1(int Arg) { __shared__ int FuncVarShared; int FuncVar; } //. // CHECK: [[META0:![0-9]+]] = !DIGlobalVariableExpression(var: [[META1:![0-9]+]], expr: !DIExpression(DIOpArg(0, ptr addrspace(1)), DIOpDeref(i32))) // CHECK: [[META1]] = distinct !DIGlobalVariable(name: "FileVarDevice", scope: [[META2:![0-9]+]], file: [[META7:![0-9]+]], line: 9, type: [[META8:![0-9]+]], isLocal: false, isDefinition: true, memorySpace: DW_MSPACE_LLVM_global) // CHECK: [[META2]] = distinct !DICompileUnit(language: DW_LANG_HIP, file: [[META3:![0-9]+]], producer: "{{.*}}clang version {{.*}}", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: [[META4:![0-9]+]], splitDebugInlining: false, nameTableKind: None) // CHECK: [[META3]] = !DIFile(filename: "{{.*}}/clang/test/CodeGenHIP/", directory: "") // CHECK: [[META4]] = !{[[META0]], [[META5:![0-9]+]], [[META9:![0-9]+]], [[META11:![0-9]+]]} // CHECK: [[META5]] = !DIGlobalVariableExpression(var: [[META6:![0-9]+]], expr: !DIExpression(DIOpArg(0, ptr addrspace(3)), DIOpDeref(i32))) // CHECK: [[META6]] = distinct !DIGlobalVariable(name: "FileVarDeviceShared", scope: [[META2]], file: [[META7]], line: 11, type: [[META8]], isLocal: false, isDefinition: true, memorySpace: DW_MSPACE_LLVM_group) // CHECK: [[META7]] = !DIFile(filename: "{{.*}}/clang/test/CodeGenHIP/debug-info-address-class-heterogeneous-dwarf.hip", directory: "") // CHECK: [[META8]] = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) // CHECK: [[META9]] = !DIGlobalVariableExpression(var: [[META10:![0-9]+]], expr: !DIExpression(DIOpArg(0, ptr addrspace(4)), DIOpDeref(i32))) // CHECK: [[META10]] = distinct !DIGlobalVariable(name: "FileVarDeviceConstant", scope: [[META2]], file: [[META7]], line: 13, type: [[META8]], isLocal: false, isDefinition: true, memorySpace: DW_MSPACE_LLVM_constant) // CHECK: [[META11]] = !DIGlobalVariableExpression(var: [[META12:![0-9]+]], expr: !DIExpression(DIOpArg(0, ptr addrspace(3)), DIOpDeref(i32))) // CHECK: [[META12]] = distinct !DIGlobalVariable(name: "FuncVarShared", scope: [[DBG13]], file: [[META7]], line: 29, type: [[META8]], isLocal: true, isDefinition: true, memorySpace: DW_MSPACE_LLVM_group) // CHECK: [[DBG13]] = distinct !DISubprogram(name: "kernel1", linkageName: "_Z7kernel1i", scope: [[META7]], file: [[META7]], line: 27, type: [[META14:![0-9]+]], scopeLine: 27, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: [[META2]], retainedNodes: [[META16:![0-9]+]]) // CHECK: [[META14]] = !DISubroutineType(types: [[META15:![0-9]+]]) // CHECK: [[META15]] = !{null, [[META8]]} // CHECK: [[META16]] = !{[[META17]], [[META18]]} // CHECK: [[META17]] = !DILocalVariable(name: "Arg", arg: 1, scope: [[DBG13]], file: [[META7]], line: 27, type: [[META8]]) // CHECK: [[META18]] = !DILocalVariable(name: "FuncVar", scope: [[DBG13]], file: [[META7]], line: 31, type: [[META8]]) // CHECK: [[META24]] = !DILocation(line: 27, column: 29, scope: [[DBG13]]) // CHECK: [[META25]] = !DILocation(line: 31, column: 7, scope: [[DBG13]]) // CHECK: [[DBG26]] = !DILocation(line: 32, column: 1, scope: [[DBG13]]) //.