brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.2 KiB · c4856a2 Raw
113 lines · plain
1--- |2 ; RUN: llc %s -mtriple=x86_64 -run-pass=livedebugvalues -o - -force-instr-ref-livedebugvalues=1 -emulate-old-livedebugvalues=0 | FileCheck %s -implicit-check-not=DBG_VALUE3 4  ;; When using instruction referencing LiveDebugValues, when a register gets5  ;; clobbered, we should transfer variable locations to backup locations, if6  ;; one is available.7  ;; I've written this test in terms of DBG_VALUEs rather than DBG_INSTR_REFs8  ;; as this is purely a LiveDebugValues feature, and should work without the9  ;; need to use any other instructoin referencing work.10 11  declare i32 @use() local_unnamed_addr;12 13  define i32 @_Z8bb_to_bb() local_unnamed_addr !dbg !12 {14  entry:15    br label %bb1, !dbg !1716  bb1:17    br label %bb2, !dbg !1718  bb2:19    br label %bb3, !dbg !1720  bb3:21    br label %bb3, !dbg !1722  bb4:23    br label %bb3, !dbg !1724  bb5:25    ret i32 0, !dbg !1726  }27 28  !llvm.dbg.cu = !{!0}29  !llvm.module.flags = !{!7, !8, !9, !10}30  !llvm.ident = !{!11}31  !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)32  !1 = !DIFile(filename: "main.cpp", directory: "F:\")33  !2 = !{}34  !3 = !{!4}35  !4 = !DIGlobalVariableExpression(var: !5, expr: !DIExpression())36  !5 = distinct !DIGlobalVariable(name: "start", scope: !0, file: !1, line: 4, type: !6, isLocal: false, isDefinition: true)37  !6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)38  !7 = !{i32 2, !"Dwarf Version", i32 4}39  !8 = !{i32 2, !"Debug Info Version", i32 3}40  !9 = !{i32 1, !"wchar_size", i32 2}41  !10 = !{i32 7, !"PIC Level", i32 2}42  !11 = !{!"clang version 10.0.0"}43  !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)44  !13 = !DISubroutineType(types: !14)45  !14 = !{!6, !6}46  !15 = !{!16}47  !16 = !DILocalVariable(name: "myVar", scope: !12, file: !1, line: 7, type: !6)48  !17 = !DILocation(line: 10, scope: !12)49 50...51---52name: _Z8bb_to_bb53debugInstrRef: true54stack:55  - { id: 0, type: spill-slot, offset: -12, size: 4, alignment: 4 }56body:  |57  bb.0.entry:58    $eax = MOV32ri 0, debug-location !1759    $eax = COPY $ebx60    DBG_VALUE $eax, $noreg, !16, !DIExpression(), debug-location !1761    ;; Over-write eax, we should recover its location as being in ebx.62    $eax = MOV32ri 0, debug-location !1763 64    ; CHECK:      DBG_VALUE $eax65    ; CHECK-NEXT: $eax = MOV32ri 066    ; CHECK-NEXT: DBG_VALUE $ebx67 68    ;; The same should occur for spills.69    $ebx = MOV32ri 2, debug-location !1770    MOV32mr $rsp, 1, _, -12, _, killed $ebx :: (store 4 into %stack.0)71    DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !1772    $ebx = MOV32ri 0, debug-location !1773 74    ; CHECK-NEXT: $ebx = MOV32ri 275    ; CHECK-NEXT: MOV32mr $rsp76    ; CHECK-NEXT: DBG_VALUE $ebx77    ; CHECK-NEXT: $ebx = MOV32ri78    ; CHECK-NEXT: DBG_VALUE $rsp79 80    ;; Try re-loading the variable value from the stack; we shouldn't issue a81    ;; DBG_VALUE to follow it, the stack locations are usually longer lived and82    ;; this reduces location list entropy. Then, clobber the stack location,83    ;; and check that we can relocate the variable to being in the loaded84    ;; register.85    $ebx = MOV32rm $rsp, 1, _, -12, _ :: (load 4 from %stack.0)86    MOV32mr $rsp, 1, _, -12, _, killed $esi :: (store 4 into %stack.0)87    ; CHECK:      $ebx = MOV32rm88    ; CHECK-NEXT: MOV32mr $rsp89    ; CHECK-NEXT: DBG_VALUE $ebx90 91    ;; Now test copies and register masks.92    $eax = COPY $ebx93    DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !1794    ;; Overwrite ebx with a copy.95    $ecx = MOV32ri 1, debug-location !1796    $ebx = COPY $ecx97 98    ; CHECK:      DBG_VALUE $ebx99    ; CHECK-NEXT: $ecx = MOV32ri100    ; CHECK-NEXT: $ebx = COPY101    ; CHECK-NEXT: DBG_VALUE $eax102 103    ;; Similarly, with a register mask104    $ebx = COPY $eax105    CALL64pcrel32 @use, csr_64, implicit $rsp, implicit $edi, implicit-def $rsp, debug-location !17106 107    ; CHECK-NEXT: $ebx = COPY $eax108    ; CHECK-NEXT: CALL64pcrel32109    ; CHECK-NEXT: DBG_VALUE $ebx110 111    RET64 $eax, debug-location !17112...113