1 # RUN: llc -emit-call-site-info -start-after=livedebugvalues -filetype=obj -o - %s | llvm-dwarfdump - | FileCheck %s
3 # Based on the following C reproducer:
5 # extern void call_int(int);
6 # extern void call_int_int(int, int);
7 # extern void call_long(long);
10 # int same_reg(int p) {
15 # int super_reg(unsigned p) {
20 # int sub_reg(int p, long q) {
21 # call_int_int(q, global);
26 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
27 target triple = "aarch64"
29 @global = external global i32, align 4
31 ; Function Attrs: noinline nounwind
32 define i32 @same_reg(i32 %p) #0 !dbg !19 {
34 call void @llvm.dbg.value(metadata i32 %p, metadata !23, metadata !DIExpression()), !dbg !24
35 tail call void @call_int(i32 %p), !dbg !25
39 declare !dbg !4 void @call_int(i32)
41 ; Function Attrs: noinline nounwind
42 define i32 @super_reg(i32 %p) #0 !dbg !27 {
44 call void @llvm.dbg.value(metadata i32 %p, metadata !32, metadata !DIExpression()), !dbg !33
45 %conv = zext i32 %p to i64, !dbg !34
46 tail call void @call_long(i64 %conv), !dbg !34
50 declare !dbg !8 void @call_long(i64)
52 ; Function Attrs: noinline nounwind
53 define i32 @sub_reg(i32 returned %p, i64 %q) #0 !dbg !36 {
55 call void @llvm.dbg.value(metadata i32 %p, metadata !40, metadata !DIExpression()), !dbg !42
56 call void @llvm.dbg.value(metadata i64 %q, metadata !41, metadata !DIExpression()), !dbg !42
57 %conv = trunc i64 %q to i32, !dbg !43
58 %0 = load i32, ptr @global, align 4, !dbg !43
59 tail call void @call_int_int(i32 %conv, i32 %0), !dbg !43
63 declare !dbg !12 void @call_int_int(i32, i32)
65 ; Function Attrs: nounwind readnone speculatable willreturn
66 declare void @llvm.dbg.value(metadata, metadata, metadata) #1
68 attributes #0 = { noinline nounwind "frame-pointer"="all" }
69 attributes #1 = { nounwind readnone speculatable willreturn }
72 !llvm.module.flags = !{!15, !16, !17}
75 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 10.0.0 (ssh://gerritmirror.rnd.ki.sw.ericsson.se:29418/flextools/llvm-project.git f76e863b549ddccd5e917e2f3ff50646915654d2)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
76 !1 = !DIFile(filename: "orrxrs.c", directory: "/repo/edasten/llvm-project/llvm")
78 !4 = !DISubprogram(name: "call_int", scope: !1, file: !1, line: 1, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
79 !5 = !DISubroutineType(types: !6)
81 !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
82 !8 = !DISubprogram(name: "call_long", scope: !1, file: !1, line: 3, type: !9, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
83 !9 = !DISubroutineType(types: !10)
85 !11 = !DIBasicType(name: "long int", size: 64, encoding: DW_ATE_signed)
86 !12 = !DISubprogram(name: "call_int_int", scope: !1, file: !1, line: 2, type: !13, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
87 !13 = !DISubroutineType(types: !14)
89 !15 = !{i32 2, !"Dwarf Version", i32 4}
90 !16 = !{i32 2, !"Debug Info Version", i32 3}
91 !17 = !{i32 1, !"wchar_size", i32 4}
92 !18 = !{!"clang version 10.0.0 (ssh://gerritmirror.rnd.ki.sw.ericsson.se:29418/flextools/llvm-project.git f76e863b549ddccd5e917e2f3ff50646915654d2)"}
93 !19 = distinct !DISubprogram(name: "same_reg", scope: !1, file: !1, line: 6, type: !20, scopeLine: 6, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !22)
94 !20 = !DISubroutineType(types: !21)
97 !23 = !DILocalVariable(name: "p", arg: 1, scope: !19, file: !1, line: 6, type: !7)
98 !24 = !DILocation(line: 0, scope: !19)
99 !25 = !DILocation(line: 7, scope: !19)
100 !26 = !DILocation(line: 8, scope: !19)
101 !27 = distinct !DISubprogram(name: "super_reg", scope: !1, file: !1, line: 11, type: !28, scopeLine: 11, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !31)
102 !28 = !DISubroutineType(types: !29)
104 !30 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned)
106 !32 = !DILocalVariable(name: "p", arg: 1, scope: !27, file: !1, line: 11, type: !30)
107 !33 = !DILocation(line: 0, scope: !27)
108 !34 = !DILocation(line: 12, scope: !27)
109 !35 = !DILocation(line: 13, scope: !27)
110 !36 = distinct !DISubprogram(name: "sub_reg", scope: !1, file: !1, line: 16, type: !37, scopeLine: 16, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !39)
111 !37 = !DISubroutineType(types: !38)
114 !40 = !DILocalVariable(name: "p", arg: 1, scope: !36, file: !1, line: 16, type: !7)
115 !41 = !DILocalVariable(name: "q", arg: 2, scope: !36, file: !1, line: 16, type: !11)
116 !42 = !DILocation(line: 0, scope: !36)
117 !43 = !DILocation(line: 17, scope: !36)
118 !44 = !DILocation(line: 18, scope: !36)
124 tracksRegLiveness: true
134 - { id: 0, type: spill-slot, offset: -8, size: 8, alignment: 8, callee-saved-register: '$lr' }
135 - { id: 1, type: spill-slot, offset: -16, size: 8, alignment: 8, callee-saved-register: '$fp' }
137 - { bb: 0, offset: 8, fwdArgRegs:
138 - { arg: 0, reg: '$w0' } }
139 machineFunctionInfo: {}
144 DBG_VALUE $w0, $noreg, !23, !DIExpression(), debug-location !24
145 DBG_VALUE $w0, $noreg, !23, !DIExpression(), debug-location !24
146 DBG_VALUE $w0, $noreg, !23, !DIExpression(), debug-location !24
147 early-clobber $sp = frame-setup STPXpre $fp, killed $lr, $sp, -2 :: (store (s64) into %stack.1), (store (s64) into %stack.0)
148 $fp = frame-setup ADDXri $sp, 0, 0
149 frame-setup CFI_INSTRUCTION def_cfa $w29, 16
150 frame-setup CFI_INSTRUCTION offset $w30, -8, debug-location !25
151 frame-setup CFI_INSTRUCTION offset $w29, -16, debug-location !25
152 BL @call_int, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $w0, implicit-def $sp, debug-location !25
153 DBG_VALUE $w0, $noreg, !23, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location !24
154 $w0 = ORRWrs $wzr, $wzr, 0, debug-location !26
155 early-clobber $sp, $fp, $lr = frame-destroy LDPXpost $sp, 2, debug-location !26 :: (load (s64) from %stack.1), (load (s64) from %stack.0)
156 RET undef $lr, implicit killed $w0, debug-location !26
160 # CHECK: DW_TAG_GNU_call_site
161 # CHECK-NEXT: DW_AT_abstract_origin ({{.*}} "call_int")
163 # CHECK: DW_TAG_GNU_call_site_parameter
164 # CHECK-NEXT: DW_AT_location (DW_OP_reg0 W0)
165 # CHECK-NEXT: DW_AT_GNU_call_site_value (DW_OP_GNU_entry_value(DW_OP_reg0 W0))
170 tracksRegLiveness: true
180 - { id: 0, type: spill-slot, offset: -8, size: 8, alignment: 8, callee-saved-register: '$lr' }
181 - { id: 1, type: spill-slot, offset: -16, size: 8, alignment: 8, callee-saved-register: '$fp' }
183 - { bb: 0, offset: 9, fwdArgRegs:
184 - { arg: 0, reg: '$x0' } }
185 machineFunctionInfo: {}
190 DBG_VALUE $w0, $noreg, !32, !DIExpression(), debug-location !33
191 DBG_VALUE $w0, $noreg, !32, !DIExpression(), debug-location !33
192 early-clobber $sp = frame-setup STPXpre $fp, killed $lr, $sp, -2 :: (store (s64) into %stack.1), (store (s64) into %stack.0)
193 $fp = frame-setup ADDXri $sp, 0, 0
194 frame-setup CFI_INSTRUCTION def_cfa $w29, 16
195 frame-setup CFI_INSTRUCTION offset $w30, -8, debug-location !34
196 frame-setup CFI_INSTRUCTION offset $w29, -16, debug-location !34
197 renamable $w0 = ORRWrs $wzr, killed renamable $w0, 0, implicit-def $x0, debug-location !34
198 DBG_VALUE $w0, $noreg, !32, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location !33
199 BL @call_long, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $x0, implicit-def $sp, debug-location !34
200 $w0 = ORRWrs $wzr, $wzr, 0, debug-location !35
201 early-clobber $sp, $fp, $lr = frame-destroy LDPXpost $sp, 2, debug-location !35 :: (load (s64) from %stack.1), (load (s64) from %stack.0)
202 RET undef $lr, implicit killed $w0, debug-location !35
206 # CHECK: DW_TAG_GNU_call_site
207 # CHECK-NEXT: DW_AT_abstract_origin ({{.*}} "call_long")
209 # CHECK: DW_TAG_GNU_call_site_parameter
210 # CHECK-NEXT: DW_AT_location (DW_OP_reg0 W0)
211 # CHECK-NEXT: DW_AT_GNU_call_site_value (DW_OP_GNU_entry_value(DW_OP_reg0 W0))
216 tracksRegLiveness: true
227 - { id: 0, type: spill-slot, offset: -16, size: 8, alignment: 16, callee-saved-register: '$x19' }
228 - { id: 1, type: spill-slot, offset: -24, size: 8, alignment: 8, callee-saved-register: '$lr' }
229 - { id: 2, type: spill-slot, offset: -32, size: 8, alignment: 8, callee-saved-register: '$fp' }
231 - { bb: 0, offset: 17, fwdArgRegs:
232 - { arg: 0, reg: '$w0' }
233 - { arg: 1, reg: '$w1' } }
234 machineFunctionInfo: {}
237 liveins: $w0, $x1, $lr, $x19
239 DBG_VALUE $w0, $noreg, !40, !DIExpression(), debug-location !42
240 DBG_VALUE $x1, $noreg, !41, !DIExpression(), debug-location !42
241 early-clobber $sp = frame-setup STPXpre $fp, killed $lr, $sp, -4 :: (store (s64) into %stack.2), (store (s64) into %stack.1)
242 frame-setup STRXui killed $x19, $sp, 2 :: (store (s64) into %stack.0)
243 $fp = frame-setup ADDXri $sp, 0, 0
244 frame-setup CFI_INSTRUCTION def_cfa $w29, 32
245 frame-setup CFI_INSTRUCTION offset $w19, -16
246 frame-setup CFI_INSTRUCTION offset $w30, -24
247 frame-setup CFI_INSTRUCTION offset $w29, -32
248 renamable $x9 = ADRP target-flags(aarch64-page) @global, debug-location !43
249 $x8 = ORRXrs $xzr, killed $x1, 0
250 DBG_VALUE $x8, $noreg, !41, !DIExpression(), debug-location !42
251 renamable $w1 = LDRWui killed renamable $x9, target-flags(aarch64-pageoff, aarch64-nc) @global, debug-location !43 :: (dereferenceable load (s32) from @global)
252 $w19 = ORRWrs $wzr, killed $w0, 0
253 DBG_VALUE $w19, $noreg, !40, !DIExpression(), debug-location !42
254 DBG_VALUE $w19, $noreg, !40, !DIExpression(), debug-location !42
255 $w0 = ORRWrs $wzr, killed $w8, 0, implicit $x8, debug-location !43
256 BL @call_int_int, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $w0, implicit killed $w1, implicit-def $sp, debug-location !43
257 DBG_VALUE $x1, $noreg, !41, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location !42
258 $w0 = ORRWrs $wzr, killed $w19, 0, debug-location !44
259 DBG_VALUE $w0, $noreg, !40, !DIExpression(), debug-location !42
260 $x19 = frame-destroy LDRXui $sp, 2, debug-location !44 :: (load (s64) from %stack.0)
261 early-clobber $sp, $fp, $lr = frame-destroy LDPXpost $sp, 4, debug-location !44 :: (load (s64) from %stack.2), (load (s64) from %stack.1)
262 RET undef $lr, implicit killed $w0, debug-location !44
266 # CHECK: DW_TAG_GNU_call_site
267 # CHECK-NEXT: DW_AT_abstract_origin ({{.*}} "call_int_int")
269 # CHECK: DW_TAG_GNU_call_site_parameter
270 # CHECK-NEXT: DW_AT_location (DW_OP_reg0 W0)
271 # CHECK-NEXT: DW_AT_GNU_call_site_value (DW_OP_GNU_entry_value(DW_OP_reg1 W1))