brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.6 KiB · 71e1770 Raw
159 lines · plain
1# RUN: llc %s -o - -filetype=obj -start-after=livedebugvalues \2# RUN:      -emit-call-site-info | \3# RUN:  llvm-dwarfdump - | FileCheck %s --implicit-check-not=call_value4#5## Test that call-site information is produced for this input, but use the6## implicit not above to check that no call value entries are produced for7## the tail call. They're clobbered by the restoration of r14 and rbx.8##9## Addresses https://github.com/llvm/llvm-project/issues/5744410#11# CHECK:       DW_TAG_call_site12# CHECK-NEXT:    DW_AT_call_origin13# CHECK-NEXT:    DW_AT_call_return_pc14#15# CHECK:      DW_TAG_call_site16# CHECK-NEXT:    DW_AT_call_origin17# CHECK-NEXT:    DW_AT_call_tail_call  (true)18# CHECK-NEXT:    DW_AT_call_pc19 20--- |21  ; ModuleID = 'out.ll'22  source_filename = "test.c"23  target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"24  target triple = "x86_64-unknown-linux-gnu"25  26  @str = private unnamed_addr constant [5 x i8] c"ohai\00", align 127  28  ; Function Attrs: nounwind uwtable29  define dso_local i32 @foo(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 !dbg !16 {30  entry:31    call void @llvm.dbg.value(metadata i64 %a, metadata !22, metadata !DIExpression()), !dbg !2432    call void @llvm.dbg.value(metadata i64 %b, metadata !23, metadata !DIExpression()), !dbg !2433    %call = tail call i32 (...) @baz() #5, !dbg !2534    %conv = trunc i64 %a to i32, !dbg !2635    %conv1 = trunc i64 %b to i32, !dbg !2736    %call2 = tail call i32 @bar(i32 noundef %conv, i32 noundef %conv1) #5, !dbg !2837    ret i32 %call2, !dbg !2938  }39  40  declare !dbg !30 i32 @baz(...) local_unnamed_addr #141  42  declare !dbg !34 i32 @bar(i32 noundef, i32 noundef) local_unnamed_addr #143  44  ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)45  declare void @llvm.dbg.value(metadata, metadata, metadata) #346  47  !llvm.dbg.cu = !{!0}48  !llvm.module.flags = !{!9, !10, !11, !12, !13, !14}49  !llvm.ident = !{!15}50  51  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, globals: !2, splitDebugInlining: false, nameTableKind: None)52  !1 = !DIFile(filename: "test.c", directory: ".", checksumkind: CSK_MD5, checksum: "98e51a9cf3bc6e1c3cc216ca4c82353a")53  !2 = !{!3}54  !3 = !DIGlobalVariableExpression(var: !4, expr: !DIExpression())55  !4 = distinct !DIGlobalVariable(scope: null, file: !1, line: 11, type: !5, isLocal: true, isDefinition: true)56  !5 = !DICompositeType(tag: DW_TAG_array_type, baseType: !6, size: 48, elements: !7)57  !6 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)58  !7 = !{!8}59  !8 = !DISubrange(count: 6)60  !9 = !{i32 7, !"Dwarf Version", i32 5}61  !10 = !{i32 2, !"Debug Info Version", i32 3}62  !11 = !{i32 1, !"wchar_size", i32 4}63  !12 = !{i32 8, !"PIC Level", i32 2}64  !13 = !{i32 7, !"PIE Level", i32 2}65  !14 = !{i32 7, !"uwtable", i32 2}66  !15 = !{!"clang"}67  !16 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 5, type: !17, scopeLine: 5, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !21)68  !17 = !DISubroutineType(types: !18)69  !18 = !{!19, !20, !20}70  !19 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)71  !20 = !DIBasicType(name: "long", size: 64, encoding: DW_ATE_signed)72  !21 = !{!22, !23}73  !22 = !DILocalVariable(name: "a", arg: 1, scope: !16, file: !1, line: 5, type: !20)74  !23 = !DILocalVariable(name: "b", arg: 2, scope: !16, file: !1, line: 5, type: !20)75  !24 = !DILocation(line: 0, scope: !16)76  !25 = !DILocation(line: 6, column: 3, scope: !16)77  !26 = !DILocation(line: 7, column: 14, scope: !16)78  !27 = !DILocation(line: 7, column: 17, scope: !16)79  !28 = !DILocation(line: 7, column: 10, scope: !16)80  !29 = !DILocation(line: 7, column: 3, scope: !16)81  !30 = !DISubprogram(name: "baz", scope: !1, file: !1, line: 4, type: !31, spFlags: DISPFlagOptimized, retainedNodes: !33)82  !31 = !DISubroutineType(types: !32)83  !32 = !{!19}84  !33 = !{}85  !34 = !DISubprogram(name: "bar", scope: !1, file: !1, line: 3, type: !35, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !33)86  !35 = !DISubroutineType(types: !36)87  !36 = !{!19, !19, !19}88  !37 = distinct !DISubprogram(name: "qux", scope: !1, file: !1, line: 10, type: !31, scopeLine: 10, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !33)89  !38 = !DILocation(line: 11, column: 3, scope: !37)90  !39 = !DILocation(line: 12, column: 3, scope: !37)91 92...93---94name:            foo95alignment:       1696tracksRegLiveness: true97tracksDebugUserValues: true98liveins:99  - { reg: '$rdi' }100  - { reg: '$rsi' }101frameInfo:102  stackSize:       24103  offsetAdjustment: -24104  maxAlignment:    1105  adjustsStack:    true106  hasCalls:        true107  maxCallFrameSize: 0108  cvBytesOfCalleeSavedRegisters: 16109  hasTailCall:     true110fixedStack:111  - { id: 0, type: spill-slot, offset: -24, size: 8, alignment: 8, callee-saved-register: '$rbx' }112  - { id: 1, type: spill-slot, offset: -16, size: 8, alignment: 16, callee-saved-register: '$r14' }113callSites:114  - { bb: 0, offset: 15 }115  - { bb: 0, offset: 28, fwdArgRegs: 116      - { arg: 0, reg: '$edi' }117      - { arg: 1, reg: '$esi' } }118debugValueSubstitutions:119  - { srcinst: 2, srcop: 0, dstinst: 1, dstop: 0, subreg: 6 }120  - { srcinst: 4, srcop: 0, dstinst: 3, dstop: 0, subreg: 6 }121machineFunctionInfo: {}122body:             |123  bb.0.entry:124    liveins: $rdi, $rsi, $r14, $rbx125  126    DBG_VALUE $rdi, $noreg, !22, !DIExpression(), debug-location !24127    DBG_VALUE $rsi, $noreg, !23, !DIExpression(), debug-location !24128    frame-setup PUSH64r killed $r14, implicit-def $rsp, implicit $rsp129    frame-setup CFI_INSTRUCTION def_cfa_offset 16130    frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp131    frame-setup CFI_INSTRUCTION def_cfa_offset 24132    frame-setup PUSH64r undef $rax, implicit-def $rsp, implicit $rsp133    frame-setup CFI_INSTRUCTION def_cfa_offset 32134    CFI_INSTRUCTION offset $rbx, -24135    CFI_INSTRUCTION offset $r14, -16136    DBG_PHI $rsi, 3137    DBG_PHI $rdi, 1138    $rbx = MOV64rr $rsi139    $r14 = MOV64rr $rdi140    dead $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags, implicit-def $al, debug-location !25141    CALL64pcrel32 target-flags(x86-plt) @baz, csr_64, implicit $rsp, implicit $ssp, implicit killed $al, implicit-def $rsp, implicit-def $ssp, implicit-def dead $eax, debug-location !25142    DBG_VALUE $rbx, $noreg, !23, !DIExpression(), debug-location !24143    DBG_VALUE $r14, $noreg, !22, !DIExpression(), debug-location !24144    $edi = MOV32rr $r14d, implicit killed $r14, debug-location !28145    $esi = MOV32rr $ebx, implicit killed $rbx, debug-location !28146    $rsp = frame-destroy ADD64ri8 $rsp, 8, implicit-def dead $eflags, debug-location !28147    frame-destroy CFI_INSTRUCTION def_cfa_offset 24, debug-location !28148      ;; This tail-call popping of rbx clobbers the call site information149    $rbx = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !28150    DBG_VALUE $rsi, $noreg, !23, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location !24151    frame-destroy CFI_INSTRUCTION def_cfa_offset 16, debug-location !28152      ;; This tail-call popping of r14 clobbers the call site information153    $r14 = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !28154    DBG_VALUE $rdi, $noreg, !22, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location !24155    frame-destroy CFI_INSTRUCTION def_cfa_offset 8, debug-location !28156    TAILJMPd64 target-flags(x86-plt) @bar, csr_64, implicit $rsp, implicit $ssp, implicit $rsp, implicit $ssp, implicit $edi, implicit $esi, debug-location !28157 158...159