brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.1 KiB · 665ca0d Raw
164 lines · plain
1# RUN: llc %s -o - -mtriple=x86_64-unknown-unknown \2# RUN:    -experimental-debug-variable-locations -run-pass=livedebugvalues\3# RUN:    | FileCheck %s4#5# Test that a DBG_INSTR_REF that refers to a DBG_PHI, will be translated into a6# DBG_VALUE of the value read at that DBG_PHI. Same original code as7# phi-coalescing.mir.8#9--- |10  ; ModuleID = 'phi-coalescing.mir'11  source_filename = "test.c"12  target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"13  target triple = "x86_64-unknown-linux-gnu"14 15  define dso_local i32 @foo(i64 %bar, i64 %baz) !dbg !7 {16  entry:17    call void @llvm.dbg.value(metadata i64 %bar, metadata !12, metadata !DIExpression()), !dbg !1318    call void @llvm.dbg.value(metadata i64 %baz, metadata !14, metadata !DIExpression()), !dbg !1319    call void @ext(i64 %bar), !dbg !1520    %add = add nsw i64 %bar, 12, !dbg !1621    call void @llvm.dbg.value(metadata i64 %add, metadata !12, metadata !DIExpression()), !dbg !1322    call void @ext(i64 %add), !dbg !1723    %call = call i64 @getlong(), !dbg !1824    %tobool = icmp ne i64 %call, 0, !dbg !1825    br i1 %tobool, label %if.then, label %if.end, !dbg !2026 27  if.then:                                          ; preds = %entry28    %add1 = add nsw i64 %add, 1, !dbg !2129    call void @llvm.dbg.value(metadata i64 %add1, metadata !12, metadata !DIExpression()), !dbg !1330    br label %if.end, !dbg !2231 32  if.end:                                           ; preds = %if.then, %entry33    %bar.addr.0 = phi i64 [ %add1, %if.then ], [ %add, %entry ], !dbg !1334    call void @llvm.dbg.value(metadata i64 %bar.addr.0, metadata !12, metadata !DIExpression()), !dbg !1335    %add2 = add nsw i64 %bar.addr.0, %baz, !dbg !2336    call void @llvm.dbg.value(metadata i64 %add2, metadata !12, metadata !DIExpression()), !dbg !1337    call void @ext(i64 %add2), !dbg !2438    %conv = trunc i64 %add2 to i32, !dbg !2539    ret i32 %conv, !dbg !2640  }41 42  ; Function Attrs: nounwind readnone speculatable willreturn43  declare void @llvm.dbg.declare(metadata, metadata, metadata)44 45  declare dso_local void @ext(i64)46 47  declare dso_local i64 @getlong()48 49  ; Function Attrs: nounwind readnone speculatable willreturn50  declare void @llvm.dbg.value(metadata, metadata, metadata)51 52  !llvm.dbg.cu = !{!0}53  !llvm.module.flags = !{!3, !4, !5}54  !llvm.ident = !{!6}55 56  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)57  !1 = !DIFile(filename: "test.c", directory: "/tmp/out.c")58  !2 = !{}59  !3 = !{i32 7, !"Dwarf Version", i32 4}60  !4 = !{i32 2, !"Debug Info Version", i32 3}61  !5 = !{i32 1, !"wchar_size", i32 4}62  !6 = !{!""}63  !7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 3, type: !8, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)64  !8 = !DISubroutineType(types: !9)65  !9 = !{!10, !11, !11}66  !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)67  !11 = !DIBasicType(name: "long int", size: 64, encoding: DW_ATE_signed)68  !12 = !DILocalVariable(name: "bar", arg: 1, scope: !7, file: !1, line: 3, type: !11)69  !13 = !DILocation(line: 0, scope: !7)70  !14 = !DILocalVariable(name: "baz", arg: 2, scope: !7, file: !1, line: 3, type: !11)71  !15 = !DILocation(line: 4, column: 3, scope: !7)72  !16 = !DILocation(line: 5, column: 7, scope: !7)73  !17 = !DILocation(line: 6, column: 3, scope: !7)74  !18 = !DILocation(line: 8, column: 7, scope: !19)75  !19 = distinct !DILexicalBlock(scope: !7, file: !1, line: 8, column: 7)76  !20 = !DILocation(line: 8, column: 7, scope: !7)77  !21 = !DILocation(line: 9, column: 9, scope: !19)78  !22 = !DILocation(line: 9, column: 5, scope: !19)79  !23 = !DILocation(line: 11, column: 7, scope: !7)80  !24 = !DILocation(line: 12, column: 3, scope: !7)81  !25 = !DILocation(line: 13, column: 10, scope: !7)82  !26 = !DILocation(line: 13, column: 3, scope: !7)83 84...85---86name:            foo87alignment:       1688tracksRegLiveness: true89debugInstrRef: true90liveins:91  - { reg: '$rdi' }92  - { reg: '$rsi' }93frameInfo:94  stackSize:       2495  offsetAdjustment: -2496  maxAlignment:    197  adjustsStack:    true98  hasCalls:        true99  maxCallFrameSize: 0100  cvBytesOfCalleeSavedRegisters: 16101fixedStack:102  - { id: 0, type: spill-slot, offset: -24, size: 8, alignment: 8, callee-saved-register: '$rbx' }103  - { id: 1, type: spill-slot, offset: -16, size: 8, alignment: 16, callee-saved-register: '$r14' }104machineFunctionInfo: {}105body:             |106  bb.0.entry:107    liveins: $rdi, $rsi, $r14, $rbx108 109    frame-setup PUSH64r killed $r14, implicit-def $rsp, implicit $rsp110    CFI_INSTRUCTION def_cfa_offset 16111    frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp112    CFI_INSTRUCTION def_cfa_offset 24113    frame-setup PUSH64r undef $rax, implicit-def $rsp, implicit $rsp114    CFI_INSTRUCTION def_cfa_offset 32115    CFI_INSTRUCTION offset $rbx, -24116    CFI_INSTRUCTION offset $r14, -16117    $r14 = MOV64rr $rsi118    $rbx = MOV64rr $rdi119    CALL64pcrel32 @ext, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, debug-location !15120    renamable $rbx = ADD64ri32 killed renamable $rbx, 12, implicit-def $eflags, debug-location !16121    $rdi = MOV64rr $rbx, debug-location !17122    CALL64pcrel32 @ext, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, debug-location !17123    CALL64pcrel32 @getlong, csr_64, implicit $rsp, implicit $ssp, implicit-def $rax, debug-location !18124    CMP64ri8 killed renamable $rax, 0, implicit-def $eflags, debug-location !18125    JCC_1 %bb.2, 4, implicit $eflags, debug-location !20126 127  bb.1.if.then:128    liveins: $rbx, $r14129 130    renamable $rbx = ADD64ri32 killed renamable $rbx, 1, implicit-def $eflags, debug-location !21131 132  bb.2.if.end:133    liveins: $rbx, $r14134 135    DBG_PHI $rbx, 1136    $rax = COPY $rbx137    $rbx = MOV64ri 0138    DBG_INSTR_REF !12, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(1, 0), debug-location !13139 140    ; This sequence should mark the contents of rbx on block entry as being the141    ; value for the variable at this DBG_INSTR_REF. We've force it to be in142    ; $rax now, so we should see a DBG_VALUE for rax:143    ; CHECK:      DBG_PHI $rbx, 1144    ; CHECK-NEXT: $rax = COPY $rbx145    ; CHECK-NEXT: $rbx = MOV64ri 0146    ; CHECK-NEXT: DBG_INSTR_REF {{.+}}, dbg-instr-ref(1, 0)147    ; CHECK-NEXT: DBG_VALUE_LIST {{.+}} $rax148 149    $rbx = COPY $rax150    renamable $rbx = ADD64rr killed renamable $rbx, killed renamable $r14, implicit-def $eflags, debug-location !23151    DBG_VALUE $rbx, $noreg, !12, !DIExpression(), debug-location !13152    $rdi = MOV64rr $rbx, debug-location !24153    CALL64pcrel32 @ext, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, debug-location !24154    $eax = MOV32rr $ebx, implicit killed $rbx, debug-location !26155    $rsp = frame-destroy ADD64ri8 $rsp, 8, implicit-def dead $eflags, debug-location !26156    CFI_INSTRUCTION def_cfa_offset 24, debug-location !26157    $rbx = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !26158    CFI_INSTRUCTION def_cfa_offset 16, debug-location !26159    $r14 = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !26160    CFI_INSTRUCTION def_cfa_offset 8, debug-location !26161    RET64 implicit $eax, debug-location !26162 163...164