119 lines · plain
1# RUN: llc -emit-call-site-info -start-after=livedebugvalues -filetype=obj %s -o -| llvm-dwarfdump -| FileCheck %s2 3# Based on the following reproducer:4#5# #include <stdint.h>6#7# extern uint32_t value32(void);8# extern uint64_t value64(void);9# extern void call32(uint32_t);10# extern void call64(uint64_t);11#12# uint32_t test_sub_reg() {13# uint32_t local = value32();14# call64(local);15# return local;16# }17 18--- |19 ; ModuleID = 'ext.c'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"23 24 ; Function Attrs: minsize nounwind optsize uwtable25 define i32 @test_sub_reg() #0 !dbg !22 {26 entry:27 %call = tail call i32 @value32(), !dbg !2928 call void @llvm.dbg.value(metadata i32 %call, metadata !28, metadata !DIExpression()), !dbg !3029 %conv = zext i32 %call to i64, !dbg !3130 tail call void @call64(i64 %conv), !dbg !3131 ret i32 %call, !dbg !3232 }33 34 declare !dbg !4 i32 @value32()35 36 declare !dbg !8 void @call64(i64)37 38 declare !dbg !12 i64 @value64()39 40 declare !dbg !15 void @call32(i32)41 42 ; Function Attrs: nounwind readnone speculatable willreturn43 declare void @llvm.dbg.value(metadata, metadata, metadata) #144 45 attributes #0 = { minsize nounwind optsize uwtable }46 attributes #1 = { nounwind readnone speculatable willreturn }47 48 !llvm.dbg.cu = !{!0}49 !llvm.module.flags = !{!18, !19, !20}50 !llvm.ident = !{!21}51 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: "/")54 !2 = !{}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)58 !6 = !{!7}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)62 !10 = !{null, !11}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)66 !14 = !{!11}67 !15 = !DISubprogram(name: "call32", scope: !1, file: !1, line: 5, type: !16, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)68 !16 = !DISubroutineType(types: !17)69 !17 = !{null, !7}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)76 !24 = !{!25}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: "")79 !27 = !{!28}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)85 86...87---88name: test_sub_reg89tracksRegLiveness: true90callSites:91 - { bb: 0, offset: 3 }92 - { bb: 0, offset: 7, fwdArgRegs:93 - { arg: 0, reg: '$rdi' } }94body: |95 bb.0.entry:96 liveins: $rbx97 98 frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp, debug-location !2999 CFI_INSTRUCTION def_cfa_offset 16100 CFI_INSTRUCTION offset $rbx, -16101 CALL64pcrel32 @value32, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $eax, debug-location !29102 $ebx = MOV32rr $eax, debug-location !29103 DBG_VALUE $ebx, $noreg, !28, !DIExpression(), debug-location !30104 renamable $edi = MOV32rr $ebx, implicit-def $rdi, debug-location !31105 CALL64pcrel32 @call64, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit-def $rsp, implicit-def $ssp, debug-location !31106 $eax = MOV32rr killed $ebx, debug-location !32107 $rbx = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !32108 CFI_INSTRUCTION def_cfa_offset 8, debug-location !32109 RET64 killed $eax, debug-location !32110 111...112 113# Verify that a call site value is emitted for the 64-bit parameter that is114# loaded using the zero-extending MOV32rr.115 116# CHECK: DW_TAG_GNU_call_site_parameter117# CHECK-NEXT: DW_AT_location (DW_OP_reg5 RDI)118# CHECK-NEXT: DW_AT_GNU_call_site_value (DW_OP_breg3 RBX+0)119