|
| 1 | +; RUN: llc -O1 -mcpu=gfx1030 -mtriple=amdgcn-amd-amdhsa -filetype=obj -o - < %s | llvm-dwarfdump --debug-info - | FileCheck %s |
| 2 | + |
| 3 | +;; Verify that we produce valid debug locations for parameters of various types. |
| 4 | + |
| 5 | +@glob_ptr = global ptr addrspace(1) null |
| 6 | + |
| 7 | +; CHECK-LABEL: DW_AT_name ("int32_k") |
| 8 | +define amdgpu_kernel void @int32_k(i32 %a) !dbg !9 { |
| 9 | + ; CHECK: DW_AT_location |
| 10 | + ; CHECK-NEXT: [0x{{[0-9a-z]+}}, 0x{{[0-9a-z]+}}): DW_OP_regx SGPR{{[0-9]+}}) |
| 11 | + tail call void @llvm.dbg.value(metadata i32 %a, metadata !12, metadata !DIExpression(DIOpArg(0, i32))), !dbg !14 |
| 12 | + store i32 %a, ptr @glob_ptr, align 4, !dbg !14 |
| 13 | + ret void, !dbg !15 |
| 14 | +} |
| 15 | + |
| 16 | +; CHECK-LABEL: DW_AT_name ("int64_k") |
| 17 | +define amdgpu_kernel void @int64_k(i64 %a) !dbg !31 { |
| 18 | + ; CHECK: DW_AT_location |
| 19 | + ; CHECK-NEXT: DW_OP_regx SGPR{{[0-9a-z]+}}, DW_OP_piece 0x4, DW_OP_regx SGPR{{[0-9a-z]+}}, DW_OP_piece 0x4, DW_OP_LLVM_user DW_OP_LLVM_piece_end |
| 20 | + tail call void @llvm.dbg.value(metadata i64 %a, metadata !32, metadata !DIExpression(DIOpArg(0, i64))), !dbg !33 |
| 21 | + store i64 %a, ptr @glob_ptr, align 8, !dbg !33 |
| 22 | + ret void, !dbg !33 |
| 23 | +} |
| 24 | + |
| 25 | +; CHECK-LABEL: DW_AT_name ("as1_ptr") |
| 26 | +define void @as1_ptr(ptr addrspace(1) %ptr) !dbg !16 { |
| 27 | + ; CHECK: DW_AT_location |
| 28 | + ; CHECK-NEXT: [0x{{[0-9a-z]+}}, 0x{{[0-9a-z]+}}): DW_OP_regx 0x{{[0-9a-z]+}}, DW_OP_piece 0x4, DW_OP_regx 0x{{[0-9a-z]+}}, DW_OP_piece 0x4) |
| 29 | + tail call void @llvm.dbg.value(metadata ptr addrspace(1) %ptr, metadata !17, metadata !DIExpression(DIOpArg(0, ptr addrspace(1)))), !dbg !20 |
| 30 | + store ptr addrspace(1) %ptr, ptr @glob_ptr, align 8, !dbg !20 |
| 31 | + ret void, !dbg !20 |
| 32 | +} |
| 33 | + |
| 34 | +; CHECK-LABEL: DW_AT_name ("int64") |
| 35 | +define void @int64(i64 %a) !dbg !21 { |
| 36 | + ; CHECK: DW_AT_location |
| 37 | + ; CHECK-NEXT: [0x{{[0-9a-z]+}}, 0x{{[0-9a-z]+}}): DW_OP_regx 0x{{[0-9a-z]+}}, DW_OP_piece 0x4, DW_OP_regx 0x{{[0-9a-z]+}}, DW_OP_piece 0x4) |
| 38 | + tail call void @llvm.dbg.value(metadata i64 %a, metadata !22, metadata !DIExpression(DIOpArg(0, i64))), !dbg !23 |
| 39 | + store i64 %a, ptr @glob_ptr, align 8, !dbg !23 |
| 40 | + ret void, !dbg !24 |
| 41 | +} |
| 42 | + |
| 43 | +; CHECK-LABEL: DW_AT_name ("int32") |
| 44 | +define void @int32(i32 %a) !dbg !25 { |
| 45 | + ; CHECK: DW_AT_location (DW_OP_regx 0x{{[0-9a-z]+}}) |
| 46 | + tail call void @llvm.dbg.value(metadata i32 %a, metadata !26, metadata !DIExpression(DIOpArg(0, i32))), !dbg !27 |
| 47 | + store i32 %a, ptr @glob_ptr, align 4, !dbg !27 |
| 48 | + ret void, !dbg !27 |
| 49 | +} |
| 50 | + |
| 51 | +; CHECK-LABEL: DW_AT_name ("gen_ptr") |
| 52 | +define void @gen_ptr(ptr %ptr) !dbg !28 { |
| 53 | + ; CHECK: DW_AT_location |
| 54 | + ; CHECK-NEXT: [0x{{[0-9a-z]+}}, 0x{{[0-9a-z]+}}): DW_OP_regx 0x{{[0-9a-z]+}}, DW_OP_piece 0x4, DW_OP_regx 0x{{[0-9a-z]+}}, DW_OP_piece 0x4) |
| 55 | + tail call void @llvm.dbg.value(metadata ptr %ptr, metadata !29, metadata !DIExpression(DIOpArg(0, ptr))), !dbg !30 |
| 56 | + store ptr %ptr, ptr @glob_ptr, align 8, !dbg !30 |
| 57 | + ret void, !dbg !30 |
| 58 | +} |
| 59 | + |
| 60 | +declare void @llvm.dbg.value(metadata, metadata, metadata) |
| 61 | + |
| 62 | +!llvm.dbg.cu = !{!0} |
| 63 | +!llvm.module.flags = !{!2, !3, !4, !5, !6, !7} |
| 64 | +!llvm.ident = !{!8} |
| 65 | + |
| 66 | +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 19.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None) |
| 67 | +!1 = !DIFile(filename: "t.cpp", directory: "/") |
| 68 | +!2 = !{i32 1, !"amdhsa_code_object_version", i32 500} |
| 69 | +!3 = !{i32 7, !"Dwarf Version", i32 5} |
| 70 | +!4 = !{i32 2, !"Debug Info Version", i32 3} |
| 71 | +!5 = !{i32 1, !"wchar_size", i32 4} |
| 72 | +!6 = !{i32 8, !"PIC Level", i32 2} |
| 73 | +!7 = !{i32 7, !"frame-pointer", i32 2} |
| 74 | +!8 = !{!"clang version 19.0.0"} |
| 75 | +!9 = distinct !DISubprogram(name: "int32_k", linkageName: "int32_k", scope: !1, file: !1, line: 1, type: !10, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0) |
| 76 | +!10 = !DISubroutineType(types: !11) |
| 77 | +!11 = !{} |
| 78 | +!12 = !DILocalVariable(name: "i32", arg: 1, scope: !9, file: !1, type: !13) |
| 79 | +!13 = !DIBasicType(name: "i32", size: 32, encoding: DW_ATE_signed) |
| 80 | +!14 = !DILocation(line: 1, column: 1, scope: !9) |
| 81 | +!15 = !DILocation(line: 2, column: 1, scope: !9) |
| 82 | +!16 = distinct !DISubprogram(name: "as1_ptr", linkageName: "as1_ptr", scope: !1, file: !1, line: 1, type: !10, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0) |
| 83 | +!17 = !DILocalVariable(name: "ptr", arg: 1, scope: !16, file: !1, line: 1, type: !18) |
| 84 | +!18 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !19, size: 64) |
| 85 | +!19 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_signed) |
| 86 | +!20 = !DILocation(line: 1, column: 1, scope: !16) |
| 87 | +!21 = distinct !DISubprogram(name: "int64", linkageName: "int64", scope: !1, file: !1, line: 1, type: !10, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0) |
| 88 | +!22 = !DILocalVariable(name: "i64", arg: 1, scope: !21, file: !1, type: !19) |
| 89 | +!23 = !DILocation(line: 1, column: 1, scope: !21) |
| 90 | +!24 = !DILocation(line: 2, column: 1, scope: !21) |
| 91 | +!25 = distinct !DISubprogram(name: "int32", linkageName: "int32", scope: !1, file: !1, line: 1, type: !10, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0) |
| 92 | +!26 = !DILocalVariable(name: "i32", arg: 1, scope: !25, file: !1, type: !13) |
| 93 | +!27 = !DILocation(line: 1, column: 1, scope: !25) |
| 94 | +!28 = distinct !DISubprogram(name: "gen_ptr", linkageName: "gen_ptr", scope: !1, file: !1, line: 1, type: !10, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0) |
| 95 | +!29 = !DILocalVariable(name: "ptr", arg: 1, scope: !28, file: !1, type: !18) |
| 96 | +!30 = !DILocation(line: 1, column: 1, scope: !28) |
| 97 | +!31 = distinct !DISubprogram(name: "int64_k", linkageName: "int64_k", scope: !1, file: !1, line: 1, type: !10, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0) |
| 98 | +!32 = !DILocalVariable(name: "i32", arg: 1, scope: !31, file: !1, type: !19) |
| 99 | +!33 = !DILocation(line: 1, column: 1, scope: !31) |
0 commit comments