1# RUN: llc -mtriple=x86_64-unknown-unknown -run-pass=machine-sink -o - %s | FileCheck %s 2 3# Based on machinesink.mir. Verify that the sub-register index in the DBG_VALUE 4# instruction is cleared when marking the debug value undef. 5 6--- | 7 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 8 target triple = "x86_64-unknown-linux-gnu" 9 10 @x = common local_unnamed_addr global i32 0, align 4 11 12 define void @test(i32* nocapture readonly %p) local_unnamed_addr !dbg !14 { 13 ; Stripped 14 entry: 15 br label %block1 16 block1: 17 br label %exit 18 exit: 19 ret void 20 } 21 22 !llvm.dbg.cu = !{!1} 23 !llvm.module.flags = !{!5, !6} 24 !llvm.ident = !{!7} 25 26 !1 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !3, globals: !3) 27 !2 = !DIFile(filename: "t.c", directory: "") 28 !3 = !{} 29 !4 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 30 !5 = !{i32 2, !"Dwarf Version", i32 4} 31 !6 = !{i32 2, !"Debug Info Version", i32 3} 32 !7 = !{!"clang version 4.0.0 "} 33 !8 = !DISubroutineType(types: !9) 34 !9 = !{null, !10} 35 !10 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !11, size: 64) 36 !11 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !12) 37 !12 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned) 38 !13 = !DIExpression() 39 !14 = distinct !DISubprogram(name: "test", scope: !2, file: !2, line: 2, type: !8, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !1, retainedNodes: !15) 40 !15 = !{!16} 41 !16 = !DILocalVariable(name: "var", scope: !14, file: !2, line: 2, type: !12) 42 !17 = !DILocation(line: 1, column: 1, scope: !14) 43 44 ; CHECK: [[VAR:![0-9]+]] = !DILocalVariable(name: "var", 45 46... 47--- 48name: test 49tracksRegLiveness: true 50liveins: 51 - { reg: '$rdi', virtual-reg: '%2' } 52 - { reg: '$rsi', virtual-reg: '%2' } 53body: | 54 bb.0.entry: 55 successors: %bb.1.block1, %bb.2.exit 56 liveins: $rdi, $esi 57 58 ; This block should _not_ have the first DBG_VALUE sunk out from it, as it 59 ; would pass a later DBG_VALUE of the same variable location. An undef 60 ; DBG_VALUE should be left behind though. Verify that the sub-register 61 ; index in the DBG_VALUE is cleared. 62 ; CHECK-LABEL: bb.0.entry: 63 ; CHECK: [[TEST2VREG:%[0-9]+]]:gr64 = COPY $rdi 64 ; CHECK-NEXT: CMP32ri $esi, 0 65 ; CHECK-NEXT: DBG_VALUE $noreg, $noreg, [[VAR]] 66 ; CHECK-NEXT: CMP32ri $esi, 0 67 ; CHECK-NEXT: DBG_VALUE 0, $noreg, [[VAR]] 68 ; CHECK-NEXT: JCC_1 %bb.1, 4 69 ; CHECK-NEXT: JMP_1 70 71 %2:gr64 = COPY $rdi 72 %5:gr64 = ADD64ri8 %2, 1, implicit-def dead $eflags 73 CMP32ri $esi, 0, implicit-def $eflags 74 DBG_VALUE %5.sub_32bit, $noreg, !16, !13, debug-location !17 75 CMP32ri $esi, 0, implicit-def $eflags 76 DBG_VALUE 0, $noreg, !16, !13, debug-location !17 77 JCC_1 %bb.1.block1, 4, implicit $eflags 78 JMP_1 %bb.2.exit 79 80 bb.1.block1: 81 successors: %bb.2.exit 82 83 %1:gr64 = ADD64ri8 %5, 4, implicit-def dead $eflags 84 JMP_1 %bb.2.exit 85 86 bb.2.exit: 87 $rax = MOV64rr %2 88 RET 0 89... 90