143 lines · plain
1# RUN: llc -O1 -emit-call-site-info -start-after=livedebugvalues -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s2 3# Based on the following C reproducer:4#5# extern void call(long, int);6# extern int a, b, c, d;7#8# int e() { return a; }9#10# int main() {11# d = c;12# b = e();13# call(c, c);14# return 0;15# }16 17--- |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"20 21 @a = external global i32, align 422 @c = external global i32, align 423 @d = external global i32, align 424 @b = external global i32, align 425 26 ; Function Attrs: noinline norecurse nounwind readonly27 define i32 @e() #0 !dbg !13 {28 entry:29 %0 = load i32, ptr @a, align 4, !dbg !1630 ret i32 %0, !dbg !1631 }32 33 ; Function Attrs: noinline nounwind34 define i32 @main() #1 !dbg !17 {35 entry:36 %0 = load i32, ptr @c, align 4, !dbg !1937 store i32 %0, ptr @d, align 4, !dbg !1938 %call = tail call i32 @e(), !dbg !2039 store i32 %call, ptr @b, align 4, !dbg !2040 %conv = sext i32 %0 to i64, !dbg !2141 tail call void @call(i64 %conv, i32 %0), !dbg !2142 ret i32 0, !dbg !2243 }44 45 declare !dbg !4 void @call(i64, i32)46 47 attributes #0 = { noinline norecurse nounwind readonly "frame-pointer"="all" }48 attributes #1 = { noinline nounwind "frame-pointer"="all" }49 50 !llvm.dbg.cu = !{!0}51 !llvm.module.flags = !{!9, !10, !11}52 !llvm.ident = !{!12}53 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: "/")56 !2 = !{}57 !3 = !{!4}58 !4 = !DISubprogram(name: "call", scope: !1, file: !1, line: 1, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)59 !5 = !DISubroutineType(types: !6)60 !6 = !{null, !7, !8}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)69 !15 = !{!8}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)76 77...78---79name: e80tracksRegLiveness: true81body: |82 bb.0.entry:83 frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp84 CFI_INSTRUCTION def_cfa_offset 1685 CFI_INSTRUCTION offset $rbp, -1686 $rbp = frame-setup MOV64rr $rsp87 CFI_INSTRUCTION def_cfa_register $rbp88 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 !1690 CFI_INSTRUCTION def_cfa $rsp, 8, debug-location !1691 RET64 $eax, debug-location !1692 93...94---95name: main96tracksRegLiveness: true97callSites:98 - { bb: 0, offset: 10 }99 - { bb: 0, offset: 14, fwdArgRegs:100 - { arg: 0, reg: '$rdi' }101 - { arg: 1, reg: '$esi' } }102body: |103 bb.0.entry:104 liveins: $rbx105 106 frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp107 CFI_INSTRUCTION def_cfa_offset 16108 CFI_INSTRUCTION offset $rbp, -16109 $rbp = frame-setup MOV64rr $rsp110 CFI_INSTRUCTION def_cfa_register $rbp111 frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp, debug-location !19112 frame-setup PUSH64r undef $rax, implicit-def $rsp, implicit $rsp113 CFI_INSTRUCTION offset $rbx, -24114 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 !20117 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 !21119 $esi = MOV32rr $edi, debug-location !21120 CALL64pcrel32 @call, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit killed $esi, implicit-def $rsp, implicit-def $ssp, debug-location !21121 $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags, debug-location !22122 $rsp = frame-destroy ADD64ri8 $rsp, 8, implicit-def dead $eflags, debug-location !22123 $rbx = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !22124 $rbp = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !22125 CFI_INSTRUCTION def_cfa $rsp, 8, debug-location !22126 RET64 $eax, debug-location !22127 128...129 130# Verify that call site entries are emitted for both parameters in the call to131# %call. Both parameters should be described by the preserved $ebx register,132# and the value for the first parameter (passed in $rdi) should be133# sign-extended to 64 bits.134 135# CHECK: DW_TAG_call_site_parameter136# 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")138#139# CHECK: DW_TAG_call_site_parameter140# CHECK-NEXT: DW_AT_location (DW_OP_reg4 RSI)141# CHECK-NEXT: DW_AT_call_value (DW_OP_breg3 RBX+0)142 143