# RUN: llc -mtriple=x86_64-unknown-unknown %s -run-pass=postra-machine-sink -o - | FileCheck %s # Test that when we run the postra machine sinker (which sinks COPYs), that # DBG_VALUEs of both sub and super-registers that depend on such COPYs are # sunk with them. --- | ; Module stripped of everything, MIR below is what's interesting ; ModuleID = '' source_filename = "justacall.cpp" target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" ; Function Attrs: noinline norecurse nounwind uwtable define dso_local i32 @main(i32 %argc, i8** nocapture readnone %argv) !dbg !14 { entry: br label %return return: ret i32 0 } !llvm.dbg.cu = !{!2} !llvm.module.flags = !{!1, !1000} !0 = !{!"dummy metadata"} !1 = !{i32 2, !"Dwarf Version", i32 4} !1000 = !{i32 2, !"Debug Info Version", i32 3} !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, nameTableKind: None) !3 = !DIFile(filename: "justacall.cpp", directory: "/tmp") !4 = !{} !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) !8 = !DIBasicType(name: "int", size: 8, encoding: DW_ATE_signed) !9 = !DIBasicType(name: "int", size: 16, encoding: DW_ATE_signed) !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) !15 = !DISubroutineType(types: !16) !16 = !{!7, !7} !20 = !{!21, !22, !23, !24} !21 = !DILocalVariable(name: "argc", arg: 1, scope: !14, file: !3, line: 7, type: !7) !22 = !DILocalVariable(name: "foo", scope: !14, file: !3, line: 7, type: !8) !23 = !DILocalVariable(name: "bar", scope: !14, file: !3, line: 7, type: !7) !24 = !DILocalVariable(name: "baz", scope: !14, file: !3, line: 7, type: !9) !100 = !DILocation(line: 1, scope: !14) ... --- name: main tracksRegLiveness: true registers: liveins: - { reg: '$edi', virtual-reg: '' } frameInfo: hasCalls: true fixedStack: stack: constants: body: | ; CHECK: ![[ARGVAR:[0-9]+]] = !DILocalVariable(name: "argc", ; CHECK: ![[FOOVAR:[0-9]+]] = !DILocalVariable(name: "foo", ; CHECK: ![[BARVAR:[0-9]+]] = !DILocalVariable(name: "bar", ; CHECK: ![[BAZVAR:[0-9]+]] = !DILocalVariable(name: "baz", ; In the following code, the: ; DBG_VALUE of $edi should not sink: it's an argument ; DBG_VALUE of $ebx should sink: it's a standard copy ; DBG_VALUE of $bx should sink: a write of its superregister sinks ; DBG_VALUE of $ecx should sink: a write of one of its subregisters sinks ; CHECK-LABEL: name: main ; CHECK: bb.0.entry: ; CHECK: successors: %bb.1(0x80000000) ; CHECK: liveins: $edi ; CHECK: DBG_VALUE $edi, $noreg, ![[BARVAR]] ; CHECK-NEXT: DBG_VALUE $edi, $noreg, ![[ARGVAR]] ; CHECK-NEXT: DBG_VALUE $noreg, $noreg, ![[BAZVAR]] ; CHECK-NEXT: renamable $cl = MOV8ri 1 ; CHECK-NEXT: DBG_VALUE $noreg, $noreg, ![[FOOVAR]] ; CHECK-NEXT: JMP_1 %bb.1 ; CHECK: bb.1.return: ; CHECK: liveins: $cl, $edi ; CHECK: renamable $ebx = COPY $edi ; CHECK-NEXT: DBG_VALUE $bx, $noreg, ![[BAZVAR]] ; CHECK-NEXT: DBG_VALUE $ebx, $noreg, ![[ARGVAR]] ; CHECK-NEXT: renamable $ch = COPY renamable $cl ; CHECK-NEXT: DBG_VALUE $ecx, $noreg, ![[FOOVAR]] ; CHECK-NEXT: $rdi = MOV32ri64 0 ; CHECK-NEXT: $eax = MOV32r0 implicit-def dead $eflags ; CHECK-NEXT: RET 0, $eax bb.0.entry: successors: %bb.1(0x40000000) liveins: $edi DBG_VALUE $edi, $noreg, !23, !DIExpression(), debug-location !100 renamable $ebx = COPY $edi DBG_VALUE $ebx, $noreg, !21, !DIExpression(), debug-location !100 DBG_VALUE $bx, $noreg, !24, !DIExpression(), debug-location !100 renamable $cl = MOV8ri 1, debug-location !100 renamable $ch = COPY renamable $cl DBG_VALUE $ecx, $noreg, !22, !DIExpression(), debug-location !100 JMP_1 %bb.1 bb.1.return: liveins: $ebx, $ch $rdi = MOV32ri64 0 $eax = MOV32r0 implicit-def dead $eflags RET 0, $eax ...