brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.9 KiB · 6dbd2cd Raw
160 lines · plain
1# RUN: llc -start-after=phi-node-elimination -stop-after=virtregrewriter %s -mtriple=x86_64-unknown-unknown -o - -experimental-debug-variable-locations | FileCheck %s2# RUN: llc -O0 -start-after=phi-node-elimination -stop-after=regallocfast %s -mtriple=x86_64-unknown-unknown -o - -experimental-debug-variable-locations | FileCheck %s --check-prefix=FASTREG3#4# Test that DBG_INSTR_REFs can pass through livedebugvariables to the end of5# regalloc without problem. Program body copied from6# livedebugvars-crossbb-interval.mir.7#8# CHECK-LABEL: bb.0:9# CHECK:       DBG_INSTR_REF {{.+}}, dbg-instr-ref(1, 0)10# CHECK:       DBG_INSTR_REF {{.+}}, dbg-instr-ref(1, 0), dbg-instr-ref(2, 0)11# CHECK-NEXT:  JMP_112# CHECK-LABEL: bb.1:13# CHECK:       DBG_INSTR_REF {{.+}}, dbg-instr-ref(2, 0)14# CHECK:       DBG_INSTR_REF {{.+}}, dbg-instr-ref(2, 0), dbg-instr-ref(3, 0)15# CHECK-NEXT:  JMP_116# CHECK-LABEL: bb.2:17# CHECK:       DBG_INSTR_REF {{.+}}, dbg-instr-ref(3, 0)18# CHECK:       DBG_INSTR_REF {{.+}}, dbg-instr-ref(3, 0), dbg-instr-ref(4, 0)19# CHECK-NEXT:  CALL64pcrel3220# CHECK-LABEL: bb.3:21# CHECK:       DBG_INSTR_REF {{.+}}, dbg-instr-ref(4, 0)22# CHECK:       DBG_INSTR_REF {{.+}}, dbg-instr-ref(4, 0), dbg-instr-ref(5, 0)23# CHECK-NEXT:  JMP_124#25#26# The fast register allocator puts some spills in -- these are no-ops as far27# as the slot indexes are concerned. It doesn't matter which side of spills28# the DBG_INSTR_REF lands on.29#30# FASTREG-LABEL: bb.0:31# FASTREG-DAG:   DBG_INSTR_REF {{.+}}, dbg-instr-ref(1, 0)32# FASTREG-DAG:   DBG_INSTR_REF {{.+}}, dbg-instr-ref(1, 0), dbg-instr-ref(2, 0)33# FASTREG-DAG:   MOV64mr34# FASTREG-DAG:   MOV32mr35# FASTREG-NEXT:  JMP_136# FASTREG-LABEL: bb.1:37# FASTREG:       DBG_INSTR_REF {{.+}}, dbg-instr-ref(2, 0)38# FASTREG-DAG:   DBG_INSTR_REF {{.+}}, dbg-instr-ref(2, 0), dbg-instr-ref(3, 0)39# FASTREG-NEXT:  JMP_140# FASTREG-LABEL: bb.2:41# FASTREG:       DBG_INSTR_REF {{.+}}, dbg-instr-ref(3, 0)42# FASTREG-DAG:   DBG_INSTR_REF {{.+}}, dbg-instr-ref(3, 0), dbg-instr-ref(4, 0)43# FASTREG-NEXT:  CALL64pcrel3244# FASTREG-LABEL: bb.3:45# FASTREG-DAG:   MOV32rm46# FASTREG-DAG:   DBG_INSTR_REF {{.+}}, dbg-instr-ref(4, 0)47# FASTREG-DAG:   DBG_INSTR_REF {{.+}}, dbg-instr-ref(4, 0), dbg-instr-ref(5, 0)48# FASTREG-DAG:   MOV32mr49# FASTREG-NEXT:  JMP_150# FASTREG-LABEL: bb.4:51# FASTREG:       DBG_INSTR_REF {{.+}}, dbg-instr-ref(5, 0)52# FASTREG-DAG:   DBG_INSTR_REF {{.+}}, dbg-instr-ref(5, 0), dbg-instr-ref(1, 0)53# FASTREG-NEXT:  RET6454 55--- |56  ; ModuleID = 'tmp.ll'57  source_filename = "tmp.ll"58  target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"59 60  %struct.a = type { i32 }61 62  ; Function Attrs: nounwind ssp63  define i32 @bar() !dbg !4 {64    ret i32 0, !dbg !1865  }66 67  declare i32 @foo();68 69  ; Function Attrs: nounwind readnone speculatable willreturn70  declare void @llvm.dbg.value(metadata, metadata, metadata)71 72  !llvm.dbg.cu = !{!0}73  !llvm.module.flags = !{!3}74  75  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "asdf", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2)76  !1 = !DIFile(filename: "bar.c", directory: "asdf")77  !2 = !{}78  !3 = !{i32 1, !"Debug Info Version", i32 3}79  !4 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 5, type: !5, virtualIndex: 6, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !8)80  !5 = !DISubroutineType(types: !6)81  !6 = !{!7}82  !7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)83  !8 = !{!9, !14}84  !9 = !DILocalVariable(name: "b", arg: 1, scope: !4, file: !1, line: 5, type: !10)85  !10 = !DIDerivedType(tag: DW_TAG_pointer_type, scope: !0, baseType: !11, size: 64, align: 64)86  !11 = !DICompositeType(tag: DW_TAG_structure_type, name: "a", scope: !0, file: !1, line: 1, size: 32, align: 32, elements: !12)87  !12 = !{!13}88  !13 = !DIDerivedType(tag: DW_TAG_member, name: "c", scope: !1, file: !1, line: 2, baseType: !7, size: 32, align: 32)89  !14 = !DILocalVariable(name: "x", scope: !15, file: !1, line: 6, type: !7)90  !15 = distinct !DILexicalBlock(scope: !4, file: !1, line: 5, column: 22)91  !16 = !DILocation(line: 5, column: 19, scope: !4)92  !17 = !DILocation(line: 6, column: 14, scope: !15)93  !18 = !DILocation(line: 8, column: 2, scope: !15)94  !19 = !DILocation(line: 7, column: 2, scope: !15)95  !29 = !DILocalVariable(name: "c", scope: !4, file: !1, line: 5, type: !10)96 97...98---99name:            bar100alignment:       16101tracksRegLiveness: true102debugInstrRef: true103registers:104  - { id: 0, class: gr64 }105  - { id: 1, class: gr32 }106  - { id: 2, class: gr64 }107  - { id: 3, class: gr64 }108  - { id: 4, class: gr32 }109  - { id: 5, class: gr32 }110  - { id: 6, class: gr32 }111  - { id: 7, class: gr32 }112liveins:113  - { reg: '$rdi', virtual-reg: '%2' }114  - { reg: '$esi', virtual-reg: '%4' }115frameInfo:116  adjustsStack:    true117  hasCalls:        true118machineFunctionInfo: {}119body:             |120  bb.0:121    liveins: $rdi, $esi122 123    %4:gr32 = COPY $esi124    %2:gr64 = COPY $rdi125    %3:gr64 = COPY killed %2126    %5:gr32 = COPY killed %4127    DBG_INSTR_REF !9, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(1, 0), debug-location !16128    DBG_INSTR_REF !29, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), dbg-instr-ref(1, 0), dbg-instr-ref(2, 0), debug-location !16129    JMP_1 %bb.3130 131  bb.1:132    DBG_INSTR_REF !9, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(2, 0), debug-location !16133    DBG_INSTR_REF !29, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), dbg-instr-ref(2, 0), dbg-instr-ref(3, 0), debug-location !16134    JMP_1 %bb.4135 136  bb.2:137    ADJCALLSTACKDOWN64 0, 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp, debug-location !19138    $edi = COPY %6, debug-location !19139    $al = MOV8ri 0, debug-location !19140    DBG_INSTR_REF !9, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(3, 0), debug-location !16141    DBG_INSTR_REF !29, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), dbg-instr-ref(3, 0), dbg-instr-ref(4, 0), debug-location !16142    CALL64pcrel32 @foo, csr_64, implicit $rsp, implicit $ssp, implicit $al, implicit $edi, implicit-def $eax, debug-location !19143    ADJCALLSTACKUP64 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp, debug-location !19144    %7:gr32 = COPY $eax, debug-location !19145    JMP_1 %bb.1146 147  bb.3:148    %6:gr32 = MOV32rm %3, 1, $noreg, 0, $noreg, debug-location !17149    DBG_INSTR_REF !9, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(4, 0), debug-location !16150    DBG_INSTR_REF !29, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), dbg-instr-ref(4, 0), dbg-instr-ref(5, 0), debug-location !16151    JMP_1 %bb.2152 153  bb.4:154    $eax = COPY %5, debug-location !18155    DBG_INSTR_REF !9, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(5, 0), debug-location !16156    DBG_INSTR_REF !29, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), dbg-instr-ref(5, 0), dbg-instr-ref(1, 0), debug-location !16157    RET64 implicit $eax, debug-location !18158 159...160