1 # RUN: llc -O1 -emit-call-site-info -start-after=livedebugvalues -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s
3 # Based on the following C reproducer:
5 # extern void call(long, int);
6 # extern int a, b, c, d;
8 # int e() { return a; }
18 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
19 target triple = "x86_64"
21 @a = external global i32, align 4
22 @c = external global i32, align 4
23 @d = external global i32, align 4
24 @b = external global i32, align 4
26 ; Function Attrs: noinline norecurse nounwind readonly
27 define i32 @e() #0 !dbg !13 {
29 %0 = load i32, i32* @a, align 4, !dbg !16
33 ; Function Attrs: noinline nounwind
34 define i32 @main() #1 !dbg !17 {
36 %0 = load i32, i32* @c, align 4, !dbg !19
37 store i32 %0, i32* @d, align 4, !dbg !19
38 %call = tail call i32 @e(), !dbg !20
39 store i32 %call, i32* @b, align 4, !dbg !20
40 %conv = sext i32 %0 to i64, !dbg !21
41 tail call void @call(i64 %conv, i32 %0), !dbg !21
45 declare !dbg !4 void @call(i64, i32)
47 attributes #0 = { noinline norecurse nounwind readonly "frame-pointer"="all" }
48 attributes #1 = { noinline nounwind "frame-pointer"="all" }
51 !llvm.module.flags = !{!9, !10, !11}
54 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 10.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, nameTableKind: None)
55 !1 = !DIFile(filename: "x86_two_defs.c", directory: "/")
58 !4 = !DISubprogram(name: "call", scope: !1, file: !1, line: 1, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
59 !5 = !DISubroutineType(types: !6)
61 !7 = !DIBasicType(name: "long int", size: 64, encoding: DW_ATE_signed)
62 !8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
63 !9 = !{i32 2, !"Dwarf Version", i32 5}
64 !10 = !{i32 2, !"Debug Info Version", i32 3}
65 !11 = !{i32 1, !"wchar_size", i32 4}
66 !12 = !{!"clang version 10.0.0"}
67 !13 = distinct !DISubprogram(name: "e", scope: !1, file: !1, line: 5, type: !14, scopeLine: 5, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
68 !14 = !DISubroutineType(types: !15)
70 !16 = !DILocation(line: 6, scope: !13)
71 !17 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 9, type: !14, scopeLine: 9, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
72 !19 = !DILocation(line: 10, scope: !17)
73 !20 = !DILocation(line: 11, scope: !17)
74 !21 = !DILocation(line: 12, scope: !17)
75 !22 = !DILocation(line: 13, scope: !17)
80 tracksRegLiveness: true
83 frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp
84 CFI_INSTRUCTION def_cfa_offset 16
85 CFI_INSTRUCTION offset $rbp, -16
86 $rbp = frame-setup MOV64rr $rsp
87 CFI_INSTRUCTION def_cfa_register $rbp
88 renamable $eax = MOV32rm $rip, 1, $noreg, @a, $noreg, debug-location !16 :: (dereferenceable load (s32) from @a)
89 $rbp = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !16
90 CFI_INSTRUCTION def_cfa $rsp, 8, debug-location !16
91 RETQ $eax, debug-location !16
96 tracksRegLiveness: true
98 - { bb: 0, offset: 10 }
99 - { bb: 0, offset: 14, fwdArgRegs:
100 - { arg: 0, reg: '$rdi' }
101 - { arg: 1, reg: '$esi' } }
106 frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp
107 CFI_INSTRUCTION def_cfa_offset 16
108 CFI_INSTRUCTION offset $rbp, -16
109 $rbp = frame-setup MOV64rr $rsp
110 CFI_INSTRUCTION def_cfa_register $rbp
111 frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp, debug-location !19
112 frame-setup PUSH64r undef $rax, implicit-def $rsp, implicit $rsp
113 CFI_INSTRUCTION offset $rbx, -24
114 renamable $ebx = MOV32rm $rip, 1, $noreg, @c, $noreg, debug-location !19 :: (dereferenceable load (s32) from @c)
115 MOV32mr $rip, 1, $noreg, @d, $noreg, renamable $ebx, debug-location !19 :: (store (s32) into @d)
116 CALL64pcrel32 @e, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $eax, debug-location !20
117 MOV32mr $rip, 1, $noreg, @b, $noreg, killed renamable $eax, debug-location !20 :: (store (s32) into @b)
118 renamable $rdi = MOVSX64rr32 killed renamable $ebx, debug-location !21
119 $esi = MOV32rr $edi, debug-location !21
120 CALL64pcrel32 @call, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit killed $esi, implicit-def $rsp, implicit-def $ssp, debug-location !21
121 $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags, debug-location !22
122 $rsp = frame-destroy ADD64ri8 $rsp, 8, implicit-def dead $eflags, debug-location !22
123 $rbx = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !22
124 $rbp = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !22
125 CFI_INSTRUCTION def_cfa $rsp, 8, debug-location !22
126 RETQ $eax, debug-location !22
130 # Verify that call site entries are emitted for both parameters in the call to
131 # %call. Both parameters should be described by the preserved $ebx register,
132 # and the value for the first parameter (passed in $rdi) should be
133 # sign-extended to 64 bits.
135 # CHECK: DW_TAG_call_site_parameter
136 # CHECK-NEXT: DW_AT_location (DW_OP_reg5 RDI)
137 # CHECK-NEXT: DW_AT_call_value (DW_OP_breg3 RBX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_convert ({{.*}}) "DW_ATE_signed_32", DW_OP_convert ({{.*}}) "DW_ATE_signed_64")
139 # CHECK: DW_TAG_call_site_parameter
140 # CHECK-NEXT: DW_AT_location (DW_OP_reg4 RSI)
141 # CHECK-NEXT: DW_AT_call_value (DW_OP_breg3 RBX+0)