109 lines · plain
1# RUN: llc -mtriple=x86_64-unknown-unknown %s -run-pass=postra-machine-sink -o - | FileCheck %s2# RUN: llc -mtriple=x86_64-unknown-unknown %s -passes='postra-machine-sink' -o - | FileCheck %s3# Test that when we run the postra machine sinker (which sinks COPYs), that4# DBG_VALUEs of both sub and super-registers that depend on such COPYs are5# sunk with them.6--- |7 ; Module stripped of everything, MIR below is what's interesting8 ; ModuleID = '<stdin>'9 source_filename = "justacall.cpp"10 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"11 target triple = "x86_64-unknown-linux-gnu"12 13 ; Function Attrs: noinline norecurse nounwind uwtable14 define dso_local i32 @main(i32 %argc, ptr nocapture readnone %argv) !dbg !14 {15 entry:16 br label %return17 return:18 ret i32 019 }20 21 !llvm.dbg.cu = !{!2}22 !llvm.module.flags = !{!1, !1000}23 24 !0 = !{!"dummy metadata"}25 !1 = !{i32 2, !"Dwarf Version", i32 4}26 !1000 = !{i32 2, !"Debug Info Version", i32 3}27 !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, nameTableKind: None)28 !3 = !DIFile(filename: "justacall.cpp", directory: "/tmp")29 !4 = !{}30 !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)31 !8 = !DIBasicType(name: "int", size: 8, encoding: DW_ATE_signed)32 !9 = !DIBasicType(name: "int", size: 16, encoding: DW_ATE_signed)33 !14 = distinct !DISubprogram(name: "main", scope: !3, file: !3, line: 7, type: !15, isLocal: false, isDefinition: true, scopeLine: 8, flags: DIFlagPrototyped, isOptimized: true, unit: !2, retainedNodes: !20)34 !15 = !DISubroutineType(types: !16)35 !16 = !{!7, !7}36 !20 = !{!21, !22, !23, !24}37 !21 = !DILocalVariable(name: "argc", arg: 1, scope: !14, file: !3, line: 7, type: !7)38 !22 = !DILocalVariable(name: "foo", scope: !14, file: !3, line: 7, type: !8)39 !23 = !DILocalVariable(name: "bar", scope: !14, file: !3, line: 7, type: !7)40 !24 = !DILocalVariable(name: "baz", scope: !14, file: !3, line: 7, type: !9)41 !100 = !DILocation(line: 1, scope: !14)42 43...44---45name: main46tracksRegLiveness: true47registers:48liveins:49 - { reg: '$edi', virtual-reg: '' }50frameInfo:51 hasCalls: true52fixedStack:53stack:54constants:55body: |56 57 ; CHECK: ![[ARGVAR:[0-9]+]] = !DILocalVariable(name: "argc",58 ; CHECK: ![[FOOVAR:[0-9]+]] = !DILocalVariable(name: "foo",59 ; CHECK: ![[BARVAR:[0-9]+]] = !DILocalVariable(name: "bar",60 ; CHECK: ![[BAZVAR:[0-9]+]] = !DILocalVariable(name: "baz",61 62 ; In the following code, the:63 ; DBG_VALUE of $edi should not sink: it's an argument64 ; DBG_VALUE of $ebx should sink: it's a standard copy65 ; DBG_VALUE of $bx should sink: a write of its superregister sinks66 ; DBG_VALUE of $ecx should sink: a write of one of its subregisters sinks67 68 ; CHECK-LABEL: name: main69 ; CHECK: bb.0.entry:70 ; CHECK: successors: %bb.1(0x80000000)71 ; CHECK: liveins: $edi72 ; CHECK: DBG_VALUE $edi, $noreg, ![[BARVAR]]73 ; CHECK-NEXT: DBG_VALUE $edi, $noreg, ![[ARGVAR]]74 ; CHECK-NEXT: DBG_VALUE $noreg, $noreg, ![[BAZVAR]]75 ; CHECK-NEXT: renamable $cl = MOV8ri 176 ; CHECK-NEXT: DBG_VALUE $noreg, $noreg, ![[FOOVAR]]77 ; CHECK-NEXT: JMP_1 %bb.178 ; CHECK: bb.1.return:79 ; CHECK: liveins: $cl, $edi80 ; CHECK: renamable $ebx = COPY $edi81 ; CHECK-NEXT: DBG_VALUE $bx, $noreg, ![[BAZVAR]]82 ; CHECK-NEXT: DBG_VALUE $ebx, $noreg, ![[ARGVAR]]83 ; CHECK-NEXT: renamable $ch = COPY renamable $cl84 ; CHECK-NEXT: DBG_VALUE $ecx, $noreg, ![[FOOVAR]]85 ; CHECK-NEXT: $rdi = MOV32ri64 086 ; CHECK-NEXT: $eax = MOV32r0 implicit-def dead $eflags87 ; CHECK-NEXT: RET 0, $eax88 bb.0.entry:89 successors: %bb.1(0x40000000)90 liveins: $edi91 92 DBG_VALUE $edi, $noreg, !23, !DIExpression(), debug-location !10093 renamable $ebx = COPY $edi94 DBG_VALUE $ebx, $noreg, !21, !DIExpression(), debug-location !10095 DBG_VALUE $bx, $noreg, !24, !DIExpression(), debug-location !10096 renamable $cl = MOV8ri 1, debug-location !10097 renamable $ch = COPY renamable $cl98 DBG_VALUE $ecx, $noreg, !22, !DIExpression(), debug-location !10099 JMP_1 %bb.1100 101 bb.1.return:102 liveins: $ebx, $ch103 104 $rdi = MOV32ri64 0105 $eax = MOV32r0 implicit-def dead $eflags106 RET 0, $eax107 108...109