brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.4 KiB · d8d1367 Raw
160 lines · plain
1--- |2 ; RUN: llc %s -mtriple=x86_64 -run-pass=livedebugvalues -o - -experimental-debug-variable-locations | FileCheck %s -implicit-check-not=DBG_VALUE3 4  define i32 @_Z8bb_to_bb() local_unnamed_addr !dbg !12 {5  entry:6    ret i32 0, !dbg !177  }8 9  !llvm.dbg.cu = !{!0}10  !llvm.module.flags = !{!7, !8, !9, !10}11  !llvm.ident = !{!11}12  !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 10.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, globals: !3, debugInfoForProfiling: true, nameTableKind: None)13  !1 = !DIFile(filename: "main.cpp", directory: "F:\")14  !2 = !{}15  !3 = !{!4}16  !4 = !DIGlobalVariableExpression(var: !5, expr: !DIExpression())17  !5 = distinct !DIGlobalVariable(name: "start", scope: !0, file: !1, line: 4, type: !6, isLocal: false, isDefinition: true)18  !6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)19  !7 = !{i32 2, !"Dwarf Version", i32 4}20  !8 = !{i32 2, !"Debug Info Version", i32 3}21  !9 = !{i32 1, !"wchar_size", i32 2}22  !10 = !{i32 7, !"PIC Level", i32 2}23  !11 = !{!"clang version 10.0.0"}24  !12 = distinct !DISubprogram(name: "bb_to_bb", linkageName: "bb_to_bb", scope: !1, file: !1, line: 6, type: !13, scopeLine: 6, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !15)25  !13 = !DISubroutineType(types: !14)26  !14 = !{!6, !6}27  !15 = !{!16}28  !16 = !DILocalVariable(name: "myVar", scope: !12, file: !1, line: 7, type: !6)29  !17 = !DILocation(line: 10, scope: !12)30 31...32---33name: _Z8bb_to_bb34debugInstrRef: true35debugValueSubstitutions:36  - { srcinst: 4, srcop: 0, dstinst: 3, dstop: 0, subreg: 0 }37body:  |38  bb.0.entry:39    $rax = MOV64ri 1, debug-instr-number 1, debug-location !1740    ; This debug instruction should identify the value as being in $rax.41    DBG_INSTR_REF !16, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(1, 0), debug-location !1742    ; CHECK: DBG_VALUE_LIST {{.+}}, $rax43 44    $rbx = COPY killed $rax, debug-location !1745    $rax = MOV64ri 1, debug-location !1746    ; CHECK: DBG_VALUE_LIST {{.+}}, $rbx47 48    DBG_INSTR_REF !16, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(2, 0), debug-location !1749    ; No instruction is labelled with the number "2". This should produce an50    ; empty variable location.51    ; CHECK: DBG_VALUE_LIST {{.+}}, $noreg52 53    $rbx = MOV64ri 1, debug-instr-number 3, debug-location !1754    JMP_1 %bb.155 56 57    ; CHECK-LABEL: bb.1:58  bb.1:59 60    DBG_INSTR_REF !16, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(3, 0), debug-location !1761    ; This refers to a value def'd in a parent block -- but it should be62    ; tracked into this block.63    ; CHECK: DBG_VALUE_LIST {{.+}}, $rbx64    JMP_1 %bb.265 66    ; CHECK-LABEL: bb.2:67  bb.2:68    ; Just like any other variable location, live-ins should be created for69    ; any successor blocks.70    ; CHECK: DBG_VALUE_LIST {{.+}}, $rbx71 72    DBG_INSTR_REF !16, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(5, 0), debug-location !1773    ; This is a debug use-before-def: the value appears a few instructions74    ; later. Any earlier value should be terminated here, _and_ we should75    ; emit a DBG_VALUE when the value becomes available.76    ; CHECK: DBG_VALUE_LIST {{.+}}, $noreg77 78    $rax = MOV64ri 1, debug-location !1779    $rax = MOV64ri 1, debug-location !1780    $rcx = MOV64ri 1, debug-instr-number 5, debug-location !1781    ; CHECK: DBG_VALUE_LIST {{.+}}, $rcx82    $rax = MOV64ri 1, debug-location !1783 84    DBG_INSTR_REF !16, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(6, 0), debug-location !1785    ; Another debug use-before-def, but across block boundaries.86    ; CHECK: DBG_VALUE_LIST {{.+}}, $noreg87    JMP_1 %bb.388 89    ; CHECK-LABEL: bb.3:90  bb.3:91    $rax = MOV64ri 1, debug-location !1792    $rdx = MOV64ri 1, debug-instr-number 6, debug-location !1793    ; CHECK: DBG_VALUE_LIST {{.+}}, $rdx94 95    ; Terminate variable location for next few blocks,96    DBG_VALUE $noreg, $noreg, !16, !DIExpression(), debug-location !1797    ; CHECK: DBG_VALUE $noreg, $noreg98    JMP_1 %bb.499 100  bb.4:101    ; The next three blocks form a debug use-before-def modelling a scenario102    ; where an instruction is sunk (debug inst in bb5, value in bb6). However,103    ; because a different path joins bb.6, we should _not_ add any DBG_VALUE.104    ; A different variable value may enter the block via the other path.105    $rdx = MOV64ri 1, implicit-def $eflags, debug-location !17106    JCC_1 %bb.6, 4, implicit $eflags, debug-location !17107  bb.5:108    DBG_INSTR_REF !16, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(7, 0), debug-location !17109    ; CHECK: DBG_VALUE_LIST {{.+}}, $noreg110    JMP_1 %bb.6, debug-location !17111  bb.6:112    $rsi = MOV64ri 1, debug-instr-number 7, debug-location !17113    JMP_1 %bb.7, debug-location !17114 115  ; A use-before-def shouldn't pass another definition of the variable location116  ; or value.117  bb.7:118    DBG_INSTR_REF !16, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(8, 0), debug-location !17119    ; CHECK: DBG_VALUE_LIST {{.+}}, $noreg120    DBG_VALUE $rax, $noreg, !16, !DIExpression(), debug-location !17121    ; CHECK: DBG_VALUE $rax, $noreg,122    $rdi = MOV64ri 1, debug-instr-number 8, debug-location !17123 124  ; Loops: use-before-defs should be live-through loops, assuming that nothing125  ; in that loop modifies the variable location.126  bb.8:127    DBG_INSTR_REF !16, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(9, 0), debug-location !17128    ; CHECK: DBG_VALUE_LIST {{.+}}, $noreg129    JCC_1 %bb.8, 4, implicit $eflags130  bb.9:131    $rax = MOV64ri 11, debug-instr-number 9, debug-location !17132    ; CHECK: DBG_VALUE_LIST {{.+}}, $rax133 134  ; Likewise, use-before-defs where anything changes the variable location135  ; or value in the loop, should be discarded.136  bb.10:137    ; live-in,138    ; CHECK: DBG_VALUE_LIST {{.+}}, $rax139    DBG_INSTR_REF !16, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(10, 0), debug-location !17140    ; CHECK: DBG_VALUE_LIST {{.+}}, $noreg141 142  bb.11:143    $rbx = MOV64ri 1, debug-location !17144 145  bb.12:146    DBG_INSTR_REF !16, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(9, 0), debug-location !17147    ; This still has a value in $rax,148    ; CHECK: DBG_VALUE_LIST {{.+}}, $rax149    JCC_1 %bb.11, 4, implicit $eflags150 151  bb.13:152    ; Live in,153    ; CHECK: DBG_VALUE_LIST {{.+}}, $rax154    $rbx = MOV64ri 11, debug-instr-number 10, debug-location !17155    ; This is instruction 10 referred to in bb.10. However, as the variable156    ; location/value has been modified in the meantime, no DBG_VALUE should be157    ; generated here.158    RET64 $eax, debug-location !17159...160