xref: /llvm-project/llvm/test/DebugInfo/ARM/move-dbg-value-after-value-list.mir (revision a971bc38cee892fb490b806eec74f2188fb70416)
1# RUN: llc %s -start-after=arm-mve-vpt-opts -stop-after=arm-prera-ldst-opt -o - | FileCheck %s
2# CHECK: %5:rgpr = t2MOVCCr %3, killed %4, 0 /* CC::eq */, $cpsr, debug-location !14
3# CHECK-NEXT: DBG_VALUE 0, $noreg, !10, !DIExpression(), debug-location !14
4# CHECK-NEXT: DBG_VALUE 1, $noreg, !10, !DIExpression(), debug-location !14
5# CHECK-NEXT: DBG_VALUE_LIST !10, !DIExpression(), $noreg, $noreg, debug-location !14
6# CHECK-NEXT: DBG_VALUE $noreg, $noreg, !10, !DIExpression(), debug-location !14
7# CHECK-NEXT: %0:rgpr = t2LDRi12 %5, 0, 14 /* CC::al */, $noreg, debug-location !14 :: (load (s32) from %ir..backtrace_user.ctl_default, align 8)
8# CHECK-NEXT: %6:rgpr = t2LDRi12 %5, 4, 14 /* CC::al */, $noreg, debug-location !14 :: (load (s32) from %ir.btc_user_copy)
9# CHECK-NEXT: %2:gpr = t2LDRi12 %5, 8, 14 /* CC::al */, $noreg, debug-location !14 :: (load (s32) from %ir.btc_user_copy_context, align 8)
10# CHECK-NEXT: DBG_VALUE %2, $noreg, !10, !DIExpression(), debug-location !14
11# CHECK-NEXT: %7:rgpr = t2ANDrr %6, %0, 14 /* CC::al */, $noreg, def $cpsr
12# CHECK-NEXT: %8:rgpr = t2ANDrr %6, %0, 14 /* CC::al */, $noreg, def $cpsr
13# CHECK-NEXT: %9:rgpr = t2ANDrr %6, %0, 14 /* CC::al */, $noreg, def $cpsr
14# CHECK-NEXT: %10:rgpr = t2ANDrr %6, %0, 14 /* CC::al */, $noreg, def $cpsr
15
16# This test specifically checks if a DBG_VALUE_LIST that is succeeded by a DBG_VALUE can be properly undefed and the DBG_VALUE is the one that is moved. Assuming both instructions describe the same local variable.
17
18--- |
19  target triple = "thumbv7k-apple-watchos8.0.0"
20  %struct.backtrace_control = type {}
21  @backtrace_user.ctl_default = internal unnamed_addr constant %struct.backtrace_control zeroinitializer, !dbg !0
22  define i32 @backtrace_user(ptr nocapture noundef writeonly %bt, i32 noundef %max_frames, ptr noundef readonly %ctl_in, ptr nocapture noundef readnone %info_out) local_unnamed_addr #0 !dbg !2 {entry:
23    %tobool.not = icmp eq ptr %ctl_in, null, !dbg !95
24    %.backtrace_user.ctl_default = select i1 %tobool.not, ptr @backtrace_user.ctl_default, ptr %ctl_in, !dbg !95
25    %btc_user_copy = getelementptr inbounds %struct.backtrace_control, ptr %.backtrace_user.ctl_default, !dbg !95
26    %btc_user_copy_context = getelementptr inbounds %struct.backtrace_control, ptr %.backtrace_user.ctl_default, !dbg !95
27    ret i32 undef, !dbg !95
28  }
29  !llvm.module.flags = !{!88, !93}
30  !llvm.dbg.cu = !{!32}
31  !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
32  !1 = distinct !DIGlobalVariable(type: !11, isDefinition: true)
33  !2 = distinct !DISubprogram(unit: !32, retainedNodes: !38)
34  !3 = !DIFile(filename: "backtrace.pp.c", directory: "/Users/shubham/Development/Delta")
35  !11 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !12)
36  !12 = distinct !DICompositeType(tag: DW_TAG_member, offset: 32)
37  !32 = distinct !DICompileUnit(language: DW_LANG_C11, file: !33, sdk: "MacOSX13.0.sdk")
38  !33 = !DIFile(filename: "/Users/shubham/Development/Delta/backtrace.pp.c", directory: "/Users/shubham/Development/Delta")
39  !38 = !{!60, !85}
40  !60 = !DILocalVariable(scope: !2, type: !62)
41  !62 = distinct !DICompositeType(tag: DW_TAG_union_type, size: 128)
42  !85 = !DILabel(scope: !2, name: "out", file: !3, line: 102)
43  !88 = !{i32 2, !"Debug Info Version", i32 3}
44  !93 = !{i32 7, !"frame-pointer", i32 1}
45  !95 = !DILocation(line: 5, column: 10, scope: !2)
46name:            backtrace_user
47registers:
48  - {id: 0, class: rgpr, }
49  - {id: 1, class: gpr, }
50  - {id: 2, class: gpr, }
51body:             |
52  bb.0.entry:
53    %10:rgpr = COPY $r2
54    %13:rgpr = t2MOV_ga_pcrel target-flags(arm-nonlazy) @backtrace_user.ctl_default, debug-location !95
55    %15:rgpr = t2MOVCCr %10, killed %13, 0 /* CC::eq */, $cpsr, debug-location !95
56    DBG_VALUE 0, $noreg, !60, !DIExpression(), debug-location !95
57    %0:rgpr = t2LDRi12 %15, 0, 14 /* CC::al */, $noreg, debug-location !95 :: (load (s32) from %ir..backtrace_user.ctl_default, align 8)
58    DBG_VALUE 1, $noreg, !60, !DIExpression(), debug-location !95
59    %16:rgpr = t2LDRi12 %15, 4, 14 /* CC::al */, $noreg, debug-location !95 :: (load (s32) from %ir.btc_user_copy)
60    DBG_VALUE_LIST !60, !DIExpression(), %16, %0, debug-location !95
61    %2:gpr = t2LDRi12 %15, 8, 14 /* CC::al */, $noreg, debug-location !95 :: (load (s32) from %ir.btc_user_copy_context, align 8)
62    DBG_VALUE %2, $noreg, !60, !DIExpression(), debug-location !95
63    %31:rgpr = t2ANDrr %16, %0, 14 /* CC::al */, $noreg, def $cpsr
64    %32:rgpr = t2ANDrr %16, %0, 14 /* CC::al */, $noreg, def $cpsr
65    %33:rgpr = t2ANDrr %16, %0, 14 /* CC::al */, $noreg, def $cpsr
66    %34:rgpr = t2ANDrr %16, %0, 14 /* CC::al */, $noreg, def $cpsr
67