1 # RUN: llc -mtriple=x86_64-unknown-unknown -run-pass=machine-sink -o - %s | FileCheck %s
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.
7 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
8 target triple = "x86_64-unknown-linux-gnu"
10 @x = common local_unnamed_addr global i32 0, align 4
12 define void @test(i32* nocapture readonly %p) local_unnamed_addr !dbg !14 {
23 !llvm.module.flags = !{!5, !6}
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: "")
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)
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)
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)
41 !16 = !DILocalVariable(name: "var", scope: !14, file: !2, line: 2, type: !12)
42 !17 = !DILocation(line: 1, column: 1, scope: !14)
44 ; CHECK: [[VAR:![0-9]+]] = !DILocalVariable(name: "var",
49 tracksRegLiveness: true
51 - { reg: '$rdi', virtual-reg: '%2' }
52 - { reg: '$rsi', virtual-reg: '%2' }
55 successors: %bb.1.block1, %bb.2.exit
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
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
81 successors: %bb.2.exit
83 %1:gr64 = ADD64ri8 %5, 4, implicit-def dead $eflags