Skip to content

Commit f719886

Browse files
committed
Add pre-commit test for LiveDebugVariables reorder issue
1 parent fe526ae commit f719886

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# RUN: llc -emit-call-site-info %s -mtriple=mips -start-before=register-coalescer -stop-after=virtregrewriter -o - | FileCheck %s
2+
3+
# FIXME: LiveDebugVariables should not reorder the stack location DBG_VALUE and
4+
# the fragmented DBG_VALUEs for aaa, as the latter may represent a stale value.
5+
# It should also not reorder the DBG_VALUEs for the different variables, as
6+
# that results in noise in pass before/after diffs.
7+
8+
# CHECK-DAG: ![[aaa:[0-9]+]] = !DILocalVariable(name: "aaa"
9+
# CHECK-DAG: ![[bbb:[0-9]+]] = !DILocalVariable(name: "bbb"
10+
# CHECK-DAG: ![[ccc:[0-9]+]] = !DILocalVariable(name: "ccc"
11+
# CHECK-DAG: ![[ddd:[0-9]+]] = !DILocalVariable(name: "ddd"
12+
13+
# CHECK: DBG_VALUE %stack.0, 0, ![[aaa]], !DIExpression()
14+
# CHECK-NEXT: DBG_VALUE 444, $noreg, ![[ddd]], !DIExpression()
15+
# CHECK-NEXT: DBG_VALUE 333, $noreg, ![[ccc]], !DIExpression()
16+
# CHECK-NEXT: DBG_VALUE 222, $noreg, ![[bbb]], !DIExpression()
17+
# CHECK-NEXT: DBG_VALUE 1002, $noreg, ![[aaa]], !DIExpression(DW_OP_LLVM_fragment, 16, 16)
18+
# CHECK-NEXT: DBG_VALUE 1001, $noreg, ![[aaa]], !DIExpression(DW_OP_LLVM_fragment, 0, 16)
19+
20+
--- |
21+
target datalayout = "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"
22+
target triple = "mips"
23+
24+
define dso_local i32 @main() local_unnamed_addr #0 !dbg !3 {
25+
entry:
26+
ret i32 0, !dbg !12
27+
}
28+
29+
declare !dbg !14 dso_local i32 @foo() local_unnamed_addr
30+
31+
declare void @llvm.dbg.value(metadata, metadata, metadata)
32+
33+
attributes #0 = { "frame-pointer"="all" }
34+
35+
!llvm.dbg.cu = !{!0}
36+
!llvm.module.flags = !{!2}
37+
38+
!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)
39+
!1 = !DIFile(filename: "main.c", directory: "/", checksumkind: CSK_MD5, checksum: "9edfcd32ce51b21ab508a4a0755aa78b")
40+
!2 = !{i32 2, !"Debug Info Version", i32 3}
41+
!3 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 12, type: !4, scopeLine: 12, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !7)
42+
!4 = !DISubroutineType(types: !5)
43+
!5 = !{!6}
44+
!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
45+
!7 = !{!8, !9, !10, !11}
46+
!8 = !DILocalVariable(name: "aaa", scope: !3, file: !1, line: 13, type: !6)
47+
!9 = !DILocalVariable(name: "bbb", scope: !3, file: !1, line: 13, type: !6)
48+
!10 = !DILocalVariable(name: "ccc", scope: !3, file: !1, line: 13, type: !6)
49+
!11 = !DILocalVariable(name: "ddd", scope: !3, file: !1, line: 13, type: !6)
50+
!12 = !DILocation(line: 13, scope: !3)
51+
!13 = !{i64 2147496201}
52+
!14 = !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !4, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized)
53+
54+
...
55+
---
56+
name: main
57+
alignment: 4
58+
tracksRegLiveness: true
59+
registers:
60+
- { id: 0, class: gpr32 }
61+
frameInfo:
62+
maxAlignment: 1
63+
adjustsStack: true
64+
hasCalls: true
65+
callSites:
66+
- { bb: 0, offset: 1 }
67+
machineFunctionInfo: {}
68+
body: |
69+
bb.0.entry:
70+
ADJCALLSTACKDOWN 16, 0, implicit-def dead $sp, implicit $sp, debug-location !12
71+
JAL @foo, csr_o32_fpxx, implicit-def dead $ra, implicit-def $sp, implicit-def $v0, debug-location !12
72+
ADJCALLSTACKUP 16, 0, implicit-def dead $sp, implicit $sp, debug-location !12
73+
%0:gpr32 = COPY killed $v0, debug-location !12
74+
DBG_VALUE 1001, $noreg, !8, !DIExpression(DW_OP_LLVM_fragment, 0, 16), debug-location !12
75+
DBG_VALUE 1002, $noreg, !8, !DIExpression(DW_OP_LLVM_fragment, 16, 16), debug-location !12
76+
DBG_VALUE 222, $noreg, !9, !DIExpression(), debug-location !12
77+
DBG_VALUE 333, $noreg, !10, !DIExpression(), debug-location !12
78+
DBG_VALUE 444, $noreg, !11, !DIExpression(), debug-location !12
79+
DBG_VALUE %0, $noreg, !8, !DIExpression(), debug-location !12
80+
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
81+
$v0 = COPY killed %0, debug-location !12
82+
RetRA implicit killed $v0, debug-location !12
83+
84+
...

0 commit comments

Comments
 (0)