1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx908 < %s | FileCheck %s
4 %struct.A = type { [100 x i32] }
6 ; The 64-bit pointer argument %arg1 will be split into two registers
7 ; and for its llvm.dbg.declare, DAG should emit two DBG_VALUE instructions
8 ; with the fragment expressions.
9 define hidden void @ptr_arg_split_subregs(%struct.A* %arg1) #0 !dbg !9 {
10 ; CHECK-LABEL: ptr_arg_split_subregs:
11 ; CHECK: .Lfunc_begin0:
12 ; CHECK: .loc 1 5 0 ; example.cpp:5:0
13 ; CHECK-NEXT: .cfi_sections .debug_frame
14 ; CHECK-NEXT: .cfi_startproc
15 ; CHECK-NEXT: ; %bb.0:
16 ; CHECK-NEXT: ;DEBUG_VALUE: ptr_arg_split_subregs:a <- [DW_OP_LLVM_fragment 32 32] [$vgpr1+0]
17 ; CHECK-NEXT: ;DEBUG_VALUE: ptr_arg_split_subregs:a <- [DW_OP_LLVM_fragment 0 32] [$vgpr0+0]
18 ; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
19 ; CHECK-NEXT: v_mov_b32_e32 v2, 1
21 ; CHECK-NEXT: .loc 1 7 13 prologue_end ; example.cpp:7:13
22 ; CHECK-NEXT: flat_store_dword v[0:1], v2 offset:396
23 ; CHECK-NEXT: .loc 1 8 5 ; example.cpp:8:5
24 ; CHECK-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
25 ; CHECK-NEXT: s_setpc_b64 s[30:31]
28 call void @llvm.dbg.declare(metadata %struct.A* %arg1, metadata !20, metadata !DIExpression()), !dbg !21
29 %gep1 = getelementptr inbounds %struct.A, %struct.A* %arg1, i32 0, i32 0, i32 99, !dbg !22
30 store i32 1, i32* %gep1, align 4, !dbg !23
34 ; FIXME: The 64-bit pointer argument %arg2 will be split between a register and
35 ; the stack memory. The SelectionDAG though failed to emit the DBG_VALUE for the
36 ; split part in memory. The two DBG_VALUE instructions emitted in the output pattern
37 ; are totally misleading. The former represent part of the incoming argument in register
38 ; while the latter was emitted for the parameter copy to a virtual register inserted
39 ; at the function entry by DAGBuilder.
40 define hidden void @ptr_arg_split_reg_mem(<30 x i32>, %struct.A* %arg2) #0 !dbg !25 {
41 ; CHECK-LABEL: ptr_arg_split_reg_mem:
42 ; CHECK: .Lfunc_begin1:
43 ; CHECK-NEXT: .loc 1 10 0 ; example.cpp:10:0
44 ; CHECK-NEXT: .cfi_startproc
45 ; CHECK-NEXT: ; %bb.0:
46 ; CHECK-NEXT: ;DEBUG_VALUE: ptr_arg_split_reg_mem:b <- [$vgpr30+0]
47 ; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
48 ; CHECK-NEXT: buffer_load_dword v31, off, s[0:3], s32{{$}}
49 ; CHECK-NEXT: v_mov_b32_e32 v0, 1
51 ; CHECK-NEXT: .loc 1 12 13 prologue_end ; example.cpp:12:13
52 ; CHECK-NEXT: s_waitcnt vmcnt(0)
53 ; CHECK-NEXT: flat_store_dword v[30:31], v0 offset:396
54 ; CHECK-NEXT: .loc 1 13 5 ; example.cpp:13:5
55 ; CHECK-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
56 ; CHECK-NEXT: s_setpc_b64 s[30:31]
59 call void @llvm.dbg.declare(metadata %struct.A* %arg2, metadata !26, metadata !DIExpression()), !dbg !27
60 %gep2 = getelementptr inbounds %struct.A, %struct.A* %arg2, i32 0, i32 0, i32 99, !dbg !28
61 store i32 1, i32* %gep2, align 4, !dbg !29
65 ; FIXME: The 64-bit pointer argument %arg3 will be entirely in the stack memory.
66 ; No DBG_VALUE emitted for the incoming argument in this case and it should be fixed.
67 define hidden void @ptr_arg_in_memory(<32 x i32>, %struct.A* %arg3) #0 !dbg !31 {
68 ; CHECK-LABEL: ptr_arg_in_memory:
69 ; CHECK: .Lfunc_begin2:
70 ; CHECK-NEXT: .loc 1 15 0 ; example.cpp:15:0
71 ; CHECK-NEXT: .cfi_startproc
72 ; CHECK-NEXT: ; %bb.0:
73 ; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
74 ; CHECK-NEXT: buffer_load_dword v1, off, s[0:3], s32 offset:8
75 ; CHECK-NEXT: buffer_load_dword v0, off, s[0:3], s32 offset:4
76 ; CHECK-NEXT: v_mov_b32_e32 v2, 1
78 ; CHECK-NEXT: .loc 1 17 13 prologue_end ; example.cpp:17:13
79 ; CHECK-NEXT: s_waitcnt vmcnt(0)
80 ; CHECK-NEXT: flat_store_dword v[0:1], v2 offset:396
81 ; CHECK-NEXT: .loc 1 18 5 ; example.cpp:18:5
82 ; CHECK-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
83 ; CHECK-NEXT: s_setpc_b64 s[30:31]
86 call void @llvm.dbg.declare(metadata %struct.A* %arg3, metadata !32, metadata !DIExpression()), !dbg !33
87 %gep3 = getelementptr inbounds %struct.A, %struct.A* %arg3, i32 0, i32 0, i32 99, !dbg !34
88 store i32 1, i32* %gep3, align 4, !dbg !35
92 declare void @llvm.dbg.declare(metadata, metadata, metadata) #0
94 attributes #0 = { nounwind }
97 !llvm.module.flags = !{!3, !4, !5, !6, !7}
100 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 13.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
101 !1 = !DIFile(filename: "example.cpp", directory: "temp")
103 !3 = !{i32 7, !"Dwarf Version", i32 4}
104 !4 = !{i32 2, !"Debug Info Version", i32 3}
105 !5 = !{i32 1, !"wchar_size", i32 4}
106 !6 = !{i32 7, !"uwtable", i32 1}
107 !7 = !{i32 7, !"frame-pointer", i32 2}
108 !8 = !{!"clang version 13.0.0"}
109 !9 = distinct !DISubprogram(name: "ptr_arg_split_subregs", scope: !10, file: !10, line: 5, type: !11, scopeLine: 5, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
110 !10 = !DIFile(filename: "example.cpp", directory: "temp")
111 !11 = !DISubroutineType(types: !12)
113 !13 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "A", file: !10, line: 1, size: 3200, flags: DIFlagTypePassByValue, elements: !14, identifier: "_ZTS1A")
115 !15 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !13, file: !10, line: 2, baseType: !16, size: 3200)
116 !16 = !DICompositeType(tag: DW_TAG_array_type, baseType: !17, size: 3200, elements: !18)
117 !17 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
119 !19 = !DISubrange(count: 100)
120 !20 = !DILocalVariable(name: "a", scope: !9, file: !10, line: 6, type: !13)
121 !21 = !DILocation(line: 6, column: 7, scope: !9)
122 !22 = !DILocation(line: 7, column: 7, scope: !9)
123 !23 = !DILocation(line: 7, column: 13, scope: !9)
124 !24 = !DILocation(line: 8, column: 5, scope: !9)
125 !25 = distinct !DISubprogram(name: "ptr_arg_split_reg_mem", scope: !10, file: !10, line: 10, type: !11, scopeLine: 10, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
126 !26 = !DILocalVariable(name: "b", scope: !25, file: !10, line: 11, type: !13)
127 !27 = !DILocation(line: 11, column: 7, scope: !25)
128 !28 = !DILocation(line: 12, column: 7, scope: !25)
129 !29 = !DILocation(line: 12, column: 13, scope: !25)
130 !30 = !DILocation(line: 13, column: 5, scope: !25)
131 !31 = distinct !DISubprogram(name: "ptr_arg_in_memory", scope: !10, file: !10, line: 15, type: !11, scopeLine: 15, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
132 !32 = !DILocalVariable(name: "c", scope: !31, file: !10, line: 16, type: !13)
133 !33 = !DILocation(line: 16, column: 7, scope: !31)
134 !34 = !DILocation(line: 17, column: 7, scope: !31)
135 !35 = !DILocation(line: 17, column: 13, scope: !31)
136 !36 = !DILocation(line: 18, column: 5, scope: !31)