brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.7 KiB · 4c3d375 Raw
123 lines · plain
1# RUN: llc -run-pass=livedebugvalues -o - %s  \2# RUN:  -experimental-debug-variable-locations=false \3# RUN: | FileCheck %s --check-prefixes=CHECK,VARLOCLDV4#5# NB: clone of this file testing InstrRefBasedLDV is in6# llvm/test/DebugInfo/MIR/X86/entry-value-of-modified-param.mir7#8#extern void fn1 (int, int, int);9#10#__attribute__((noinline))11#int12#fn2 (int a, int b, int c) {13#  int q = 2 + a;14#15#  fn1 (5, 6, q);16#17#  b = b + 7;18#  if (b < 17)19#    return 1;20#  else21#    return 0;22#}23#24# CHECK: ![[ARG_A:.*]] = !DILocalVariable(name: "a"25# CHECK: ![[ARG_B:.*]] = !DILocalVariable(name: "b"26# CHECK: ![[ARG_C:.*]] = !DILocalVariable(name: "c"27## TODO: Support KILL instruction, which doesn't clobber parameter value.28# VARLOCLDV: DBG_VALUE $edi, $noreg, ![[ARG_A]], !DIExpression()29# CHECK: DBG_VALUE $edx, $noreg, ![[ARG_C]], !DIExpression(DW_OP_LLVM_entry_value, 1)30# VARLOCLDV-NOT: DBG_VALUE $edi, $noreg, ![[ARG_A]], !DIExpression(DW_OP_LLVM_entry_value, 1)31# CHECK-NOT: DBG_VALUE $esi, $noreg, ![[ARG_B]], !DIExpression(DW_OP_LLVM_entry_value, 1)32#33--- |34  ; ModuleID = 'test.c'35  source_filename = "test.c"36  target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"37  target triple = "x86_64-unknown-linux-gnu"38 39  ; Function Attrs: noinline nounwind uwtable40  define dso_local i32 @fn2(i32 %a, i32 %b, i32 %c) local_unnamed_addr !dbg !12 {41  entry:42    call void @llvm.dbg.value(metadata i32 %a, metadata !16, metadata !DIExpression()), !dbg !2043    call void @llvm.dbg.value(metadata i32 %b, metadata !17, metadata !DIExpression()), !dbg !2044    call void @llvm.dbg.value(metadata i32 %c, metadata !18, metadata !DIExpression()), !dbg !2045    %add = add nsw i32 %a, 2, !dbg !2146    call void @llvm.dbg.value(metadata i32 %add, metadata !19, metadata !DIExpression()), !dbg !2047    tail call void @fn1(i32 5, i32 6, i32 %add), !dbg !2248    call void @llvm.dbg.value(metadata i32 %b, metadata !17, metadata !DIExpression(DW_OP_plus_uconst, 7, DW_OP_stack_value)), !dbg !2049    %cmp = icmp slt i32 %b, 10, !dbg !2350    %. = zext i1 %cmp to i32, !dbg !2551    ret i32 %., !dbg !2652  }53 54  declare !dbg !4 dso_local void @fn1(i32, i32, i32) local_unnamed_addr55 56  ; Function Attrs: nounwind readnone speculatable willreturn57  declare void @llvm.dbg.value(metadata, metadata, metadata)58 59  !llvm.dbg.cu = !{!0}60  !llvm.module.flags = !{!8, !9, !10}61  !llvm.ident = !{!11}62 63  !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)64  !1 = !DIFile(filename: "test.c", directory: "/dir")65  !2 = !{}66  !3 = !{!4}67  !4 = !DISubprogram(name: "fn1", scope: !1, file: !1, line: 1, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)68  !5 = !DISubroutineType(types: !6)69  !6 = !{null, !7, !7, !7}70  !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)71  !8 = !{i32 2, !"Dwarf Version", i32 4}72  !9 = !{i32 2, !"Debug Info Version", i32 3}73  !10 = !{i32 1, !"wchar_size", i32 4}74  !11 = !{!"clang version 10.0.0"}75  !12 = distinct !DISubprogram(name: "fn2", scope: !1, file: !1, line: 5, type: !13, scopeLine: 6, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !15)76  !13 = !DISubroutineType(types: !14)77  !14 = !{!7, !7, !7, !7}78  !15 = !{!16, !17, !18, !19}79  !16 = !DILocalVariable(name: "a", arg: 1, scope: !12, file: !1, line: 5, type: !7)80  !17 = !DILocalVariable(name: "b", arg: 2, scope: !12, file: !1, line: 5, type: !7)81  !18 = !DILocalVariable(name: "c", arg: 3, scope: !12, file: !1, line: 5, type: !7)82  !19 = !DILocalVariable(name: "q", scope: !12, file: !1, line: 7, type: !7)83  !20 = !DILocation(line: 0, scope: !12)84  !21 = !DILocation(line: 7, column: 15, scope: !12)85  !22 = !DILocation(line: 9, column: 5, scope: !12)86  !23 = !DILocation(line: 12, column: 11, scope: !24)87  !24 = distinct !DILexicalBlock(scope: !12, file: !1, line: 12, column: 9)88  !25 = !DILocation(line: 0, scope: !24)89  !26 = !DILocation(line: 16, column: 1, scope: !12)90 91...92---93name:            fn294alignment:       1695body:             |96  bb.0.entry:97    liveins: $edi, $esi, $rbx98 99    DBG_VALUE $edi, $noreg, !16, !DIExpression(), debug-location !20100    DBG_VALUE $esi, $noreg, !17, !DIExpression(), debug-location !20101    DBG_VALUE $edx, $noreg, !18, !DIExpression(), debug-location !20102    frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp103    CFI_INSTRUCTION def_cfa_offset 16104    CFI_INSTRUCTION offset $rbx, -16105    $ebx = MOV32rr $esi106    DBG_VALUE $ebx, $noreg, !17, !DIExpression(), debug-location !20107    renamable $edi = KILL $edi, implicit-def $rdi108    DBG_VALUE $edi, $noreg, !16, !DIExpression(), debug-location !20109    renamable $edx = LEA64_32r killed renamable $rdi, 1, $noreg, 2, $noreg, debug-location !21110    DBG_VALUE $edx, $noreg, !19, !DIExpression(), debug-location !20111    $edi = MOV32ri 5, debug-location !22112    $esi = MOV32ri 6, debug-location !22113    CALL64pcrel32 @fn1, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit $esi, implicit $edx, implicit-def $rsp, implicit-def $ssp, debug-location !22114    DBG_VALUE $ebx, $noreg, !17, !DIExpression(DW_OP_plus_uconst, 7, DW_OP_stack_value), debug-location !20115    renamable $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags, debug-location !23116    CMP32ri8 killed renamable $ebx, 10, implicit-def $eflags, debug-location !23117    renamable $al = SETCCr 12, implicit killed $eflags, implicit killed $eax, implicit-def $eax, debug-location !23118    $rbx = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !26119    CFI_INSTRUCTION def_cfa_offset 8, debug-location !26120    RET64 $eax, debug-location !26121 122...123