1 # RUN: llc -emit-call-site-info -start-after=livedebugvalues -filetype=obj %s -o -| llvm-dwarfdump -| FileCheck %s
3 # Based on the following reproducer:
7 # extern uint32_t value32(void);
8 # extern uint64_t value64(void);
9 # extern void call32(uint32_t);
10 # extern void call64(uint64_t);
12 # uint32_t test_sub_reg() {
13 # uint32_t local = value32();
20 source_filename = "ext.c"
21 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
22 target triple = "x86_64-unknown-linux-gnu"
24 ; Function Attrs: minsize nounwind optsize uwtable
25 define i32 @test_sub_reg() #0 !dbg !22 {
27 %call = tail call i32 @value32(), !dbg !29
28 call void @llvm.dbg.value(metadata i32 %call, metadata !28, metadata !DIExpression()), !dbg !30
29 %conv = zext i32 %call to i64, !dbg !31
30 tail call void @call64(i64 %conv), !dbg !31
31 ret i32 %call, !dbg !32
34 declare !dbg !4 i32 @value32()
36 declare !dbg !8 void @call64(i64)
38 declare !dbg !12 i64 @value64()
40 declare !dbg !15 void @call32(i32)
42 ; Function Attrs: nounwind readnone speculatable willreturn
43 declare void @llvm.dbg.value(metadata, metadata, metadata) #1
45 attributes #0 = { minsize nounwind optsize uwtable }
46 attributes #1 = { nounwind readnone speculatable willreturn }
49 !llvm.module.flags = !{!18, !19, !20}
52 !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)
53 !1 = !DIFile(filename: "ext.c", directory: "/")
55 !3 = !{!4, !8, !12, !15}
56 !4 = !DISubprogram(name: "value32", scope: !1, file: !1, line: 3, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
57 !5 = !DISubroutineType(types: !6)
59 !7 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned)
60 !8 = !DISubprogram(name: "call64", scope: !1, file: !1, line: 6, type: !9, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
61 !9 = !DISubroutineType(types: !10)
63 !11 = !DIBasicType(name: "long unsigned int", size: 64, encoding: DW_ATE_unsigned)
64 !12 = !DISubprogram(name: "value64", scope: !1, file: !1, line: 4, type: !13, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
65 !13 = !DISubroutineType(types: !14)
67 !15 = !DISubprogram(name: "call32", scope: !1, file: !1, line: 5, type: !16, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
68 !16 = !DISubroutineType(types: !17)
70 !18 = !{i32 2, !"Dwarf Version", i32 4}
71 !19 = !{i32 2, !"Debug Info Version", i32 3}
72 !20 = !{i32 1, !"wchar_size", i32 4}
73 !21 = !{!"clang version 10.0.0"}
74 !22 = distinct !DISubprogram(name: "test_sub_reg", scope: !1, file: !1, line: 8, type: !23, scopeLine: 8, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !27)
75 !23 = !DISubroutineType(types: !24)
77 !25 = !DIDerivedType(tag: DW_TAG_typedef, name: "uint32_t", file: !26, line: 52, baseType: !7)
78 !26 = !DIFile(filename: "/usr/include/stdint.h", directory: "")
80 !28 = !DILocalVariable(name: "local", scope: !22, file: !1, line: 9, type: !25)
81 !29 = !DILocation(line: 9, scope: !22)
82 !30 = !DILocation(line: 0, scope: !22)
83 !31 = !DILocation(line: 10, scope: !22)
84 !32 = !DILocation(line: 11, scope: !22)
89 tracksRegLiveness: true
91 - { bb: 0, offset: 3 }
92 - { bb: 0, offset: 7, fwdArgRegs:
93 - { arg: 0, reg: '$rdi' } }
98 frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp, debug-location !29
99 CFI_INSTRUCTION def_cfa_offset 16
100 CFI_INSTRUCTION offset $rbx, -16
101 CALL64pcrel32 @value32, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $eax, debug-location !29
102 $ebx = MOV32rr $eax, debug-location !29
103 DBG_VALUE $ebx, $noreg, !28, !DIExpression(), debug-location !30
104 renamable $edi = MOV32rr $ebx, implicit-def $rdi, debug-location !31
105 CALL64pcrel32 @call64, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit-def $rsp, implicit-def $ssp, debug-location !31
106 $eax = MOV32rr killed $ebx, debug-location !32
107 $rbx = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !32
108 CFI_INSTRUCTION def_cfa_offset 8, debug-location !32
109 RETQ killed $eax, debug-location !32
113 # Verify that a call site value is emitted for the 64-bit parameter that is
114 # loaded using the zero-extending MOV32rr.
116 # CHECK: DW_TAG_GNU_call_site_parameter
117 # CHECK-NEXT: DW_AT_location (DW_OP_reg5 RDI)
118 # CHECK-NEXT: DW_AT_GNU_call_site_value (DW_OP_breg3 RBX+0)