90 lines · plain
1# RUN: llc -mtriple=x86_64-unknown-unknown -run-pass=machine-sink -o - %s | FileCheck %s2 3# Based on machinesink.mir. Verify that the sub-register index in the DBG_VALUE4# 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 411 12 define void @test(ptr nocapture readonly %p) local_unnamed_addr !dbg !14 {13 ; Stripped14 entry:15 br label %block116 block1:17 br label %exit18 exit:19 ret void20 }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: test49tracksRegLiveness: true50liveins:51 - { reg: '$rdi', virtual-reg: '%2' }52 - { reg: '$rsi', virtual-reg: '%2' }53body: |54 bb.0.entry:55 successors: %bb.1.block1, %bb.2.exit56 liveins: $rdi, $esi57 58 ; This block should _not_ have the first DBG_VALUE sunk out from it, as it59 ; would pass a later DBG_VALUE of the same variable location. An undef60 ; DBG_VALUE should be left behind though. Verify that the sub-register61 ; index in the DBG_VALUE is cleared.62 ; CHECK-LABEL: bb.0.entry:63 ; CHECK: [[TEST2VREG:%[0-9]+]]:gr64 = COPY $rdi64 ; CHECK-NEXT: CMP32ri $esi, 065 ; CHECK-NEXT: DBG_VALUE $noreg, $noreg, [[VAR]]66 ; CHECK-NEXT: CMP32ri $esi, 067 ; CHECK-NEXT: DBG_VALUE 0, $noreg, [[VAR]]68 ; CHECK-NEXT: JCC_1 %bb.1, 469 ; CHECK-NEXT: JMP_170 71 %2:gr64 = COPY $rdi72 %5:gr64 = ADD64ri32 %2, 1, implicit-def dead $eflags73 CMP32ri $esi, 0, implicit-def $eflags74 DBG_VALUE %5.sub_32bit, $noreg, !16, !13, debug-location !1775 CMP32ri $esi, 0, implicit-def $eflags76 DBG_VALUE 0, $noreg, !16, !13, debug-location !1777 JCC_1 %bb.1.block1, 4, implicit $eflags78 JMP_1 %bb.2.exit79 80 bb.1.block1:81 successors: %bb.2.exit82 83 %1:gr64 = ADD64ri32 %5, 4, implicit-def dead $eflags84 JMP_1 %bb.2.exit85 86 bb.2.exit:87 $rax = MOV64rr %288 RET 089...90