xref: /llvm-project/llvm/test/DebugInfo/Mips/livedebugvariables-reorder.mir (revision 97861981cccce546b37f56e3e99e68d37c7586c7)
1f719886eSDavid Stenberg# RUN: llc -emit-call-site-info %s -mtriple=mips -start-before=register-coalescer -stop-after=virtregrewriter -o - | FileCheck %s
2f719886eSDavid Stenberg
3*97861981SDavid Stenberg# Verify that LiveDebugVariables does not reorder the stack location DBG_VALUE
4*97861981SDavid Stenberg# and the fragmented DBG_VALUEs for aaa, as the latter may represent a stale
5*97861981SDavid Stenberg# value. It should also not reorder the DBG_VALUEs for the different variables,
6*97861981SDavid Stenberg# as that results in noise in pass before/after diffs.
7f719886eSDavid Stenberg
8f719886eSDavid Stenberg# CHECK-DAG: ![[aaa:[0-9]+]] = !DILocalVariable(name: "aaa"
9f719886eSDavid Stenberg# CHECK-DAG: ![[bbb:[0-9]+]] = !DILocalVariable(name: "bbb"
10f719886eSDavid Stenberg# CHECK-DAG: ![[ccc:[0-9]+]] = !DILocalVariable(name: "ccc"
11f719886eSDavid Stenberg# CHECK-DAG: ![[ddd:[0-9]+]] = !DILocalVariable(name: "ddd"
12f719886eSDavid Stenberg
13*97861981SDavid Stenberg# CHECK: DBG_VALUE 1001, $noreg, ![[aaa]], !DIExpression(DW_OP_LLVM_fragment, 0, 16)
14f719886eSDavid Stenberg# CHECK-NEXT: DBG_VALUE 1002, $noreg, ![[aaa]], !DIExpression(DW_OP_LLVM_fragment, 16, 16)
15*97861981SDavid Stenberg# CHECK-NEXT: DBG_VALUE 222, $noreg, ![[bbb]], !DIExpression()
16*97861981SDavid Stenberg# CHECK-NEXT: DBG_VALUE 333, $noreg, ![[ccc]], !DIExpression()
17*97861981SDavid Stenberg# CHECK-NEXT: DBG_VALUE 444, $noreg, ![[ddd]], !DIExpression()
18*97861981SDavid Stenberg# CHECK-NEXT: DBG_VALUE %stack.0, 0, ![[aaa]], !DIExpression()
19f719886eSDavid Stenberg
20f719886eSDavid Stenberg--- |
21f719886eSDavid Stenberg  target datalayout = "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"
22f719886eSDavid Stenberg  target triple = "mips"
23f719886eSDavid Stenberg
24f719886eSDavid Stenberg  define dso_local i32 @main() local_unnamed_addr #0 !dbg !3 {
25f719886eSDavid Stenberg  entry:
26f719886eSDavid Stenberg    ret i32 0, !dbg !12
27f719886eSDavid Stenberg  }
28f719886eSDavid Stenberg
29f719886eSDavid Stenberg  declare !dbg !14 dso_local i32 @foo() local_unnamed_addr
30f719886eSDavid Stenberg
31f719886eSDavid Stenberg  declare void @llvm.dbg.value(metadata, metadata, metadata)
32f719886eSDavid Stenberg
33f719886eSDavid Stenberg  attributes #0 = { "frame-pointer"="all" }
34f719886eSDavid Stenberg
35f719886eSDavid Stenberg  !llvm.dbg.cu = !{!0}
36f719886eSDavid Stenberg  !llvm.module.flags = !{!2}
37f719886eSDavid Stenberg
38f719886eSDavid Stenberg  !0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "clang version 19.0.0git", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
39f719886eSDavid Stenberg  !1 = !DIFile(filename: "main.c", directory: "/", checksumkind: CSK_MD5, checksum: "9edfcd32ce51b21ab508a4a0755aa78b")
40f719886eSDavid Stenberg  !2 = !{i32 2, !"Debug Info Version", i32 3}
41f719886eSDavid Stenberg  !3 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 12, type: !4, scopeLine: 12, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !7)
42f719886eSDavid Stenberg  !4 = !DISubroutineType(types: !5)
43f719886eSDavid Stenberg  !5 = !{!6}
44f719886eSDavid Stenberg  !6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
45f719886eSDavid Stenberg  !7 = !{!8, !9, !10, !11}
46f719886eSDavid Stenberg  !8 = !DILocalVariable(name: "aaa", scope: !3, file: !1, line: 13, type: !6)
47f719886eSDavid Stenberg  !9 = !DILocalVariable(name: "bbb", scope: !3, file: !1, line: 13, type: !6)
48f719886eSDavid Stenberg  !10 = !DILocalVariable(name: "ccc", scope: !3, file: !1, line: 13, type: !6)
49f719886eSDavid Stenberg  !11 = !DILocalVariable(name: "ddd", scope: !3, file: !1, line: 13, type: !6)
50f719886eSDavid Stenberg  !12 = !DILocation(line: 13, scope: !3)
51f719886eSDavid Stenberg  !13 = !{i64 2147496201}
52f719886eSDavid Stenberg  !14 = !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !4, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized)
53f719886eSDavid Stenberg
54f719886eSDavid Stenberg...
55f719886eSDavid Stenberg---
56f719886eSDavid Stenbergname:            main
57f719886eSDavid Stenbergalignment:       4
58f719886eSDavid StenbergtracksRegLiveness: true
59f719886eSDavid Stenbergregisters:
60f719886eSDavid Stenberg  - { id: 0, class: gpr32 }
61f719886eSDavid StenbergframeInfo:
62f719886eSDavid Stenberg  maxAlignment:    1
63f719886eSDavid Stenberg  adjustsStack:    true
64f719886eSDavid Stenberg  hasCalls:        true
65f719886eSDavid StenbergcallSites:
66f719886eSDavid Stenberg  - { bb: 0, offset: 1 }
67f719886eSDavid StenbergmachineFunctionInfo: {}
68f719886eSDavid Stenbergbody:             |
69f719886eSDavid Stenberg  bb.0.entry:
70f719886eSDavid Stenberg    ADJCALLSTACKDOWN 16, 0, implicit-def dead $sp, implicit $sp, debug-location !12
71f719886eSDavid Stenberg    JAL @foo, csr_o32_fpxx, implicit-def dead $ra, implicit-def $sp, implicit-def $v0, debug-location !12
72f719886eSDavid Stenberg    ADJCALLSTACKUP 16, 0, implicit-def dead $sp, implicit $sp, debug-location !12
73f719886eSDavid Stenberg    %0:gpr32 = COPY killed $v0, debug-location !12
74f719886eSDavid Stenberg    DBG_VALUE 1001, $noreg, !8, !DIExpression(DW_OP_LLVM_fragment, 0, 16), debug-location !12
75f719886eSDavid Stenberg    DBG_VALUE 1002, $noreg, !8, !DIExpression(DW_OP_LLVM_fragment, 16, 16), debug-location !12
76f719886eSDavid Stenberg    DBG_VALUE 222, $noreg, !9, !DIExpression(), debug-location !12
77f719886eSDavid Stenberg    DBG_VALUE 333, $noreg, !10, !DIExpression(), debug-location !12
78f719886eSDavid Stenberg    DBG_VALUE 444, $noreg, !11, !DIExpression(), debug-location !12
79f719886eSDavid Stenberg    DBG_VALUE %0, $noreg, !8, !DIExpression(), debug-location !12
80f719886eSDavid Stenberg    INLINEASM &"", 1 /* sideeffect attdialect */, 12 /* clobber */, implicit-def dead early-clobber $v0, 12 /* clobber */, implicit-def dead early-clobber $v1, 12 /* clobber */, implicit-def dead early-clobber $a0, 12 /* clobber */, implicit-def dead early-clobber $a1, 12 /* clobber */, implicit-def dead early-clobber $a2, 12 /* clobber */, implicit-def dead early-clobber $a3, 12 /* clobber */, implicit-def dead early-clobber $t0, 12 /* clobber */, implicit-def dead early-clobber $t1, 12 /* clobber */, implicit-def dead early-clobber $t2, 12 /* clobber */, implicit-def dead early-clobber $t3, 12 /* clobber */, implicit-def dead early-clobber $t4, 12 /* clobber */, implicit-def dead early-clobber $t5, 12 /* clobber */, implicit-def dead early-clobber $t6, 12 /* clobber */, implicit-def dead early-clobber $t7, 12 /* clobber */, implicit-def dead early-clobber $t8, 12 /* clobber */, implicit-def dead early-clobber $t9, 12 /* clobber */, implicit-def dead early-clobber $gp, 12 /* clobber */, implicit-def dead early-clobber $ra, 12 /* clobber */, implicit-def dead early-clobber $s0, 12 /* clobber */, implicit-def dead early-clobber $s1, 12 /* clobber */, implicit-def dead early-clobber $s2, 12 /* clobber */, implicit-def dead early-clobber $s3, 12 /* clobber */, implicit-def dead early-clobber $s4, 12 /* clobber */, implicit-def dead early-clobber $s5, 12 /* clobber */, implicit-def dead early-clobber $s6, 12 /* clobber */, implicit-def dead early-clobber $s7, 12 /* clobber */, implicit-def dead early-clobber $at, !13, debug-location !12
81f719886eSDavid Stenberg    $v0 = COPY killed %0, debug-location !12
82f719886eSDavid Stenberg    RetRA implicit killed $v0, debug-location !12
83f719886eSDavid Stenberg
84f719886eSDavid Stenberg...
85