xref: /llvm-project/llvm/test/CodeGen/RISCV/rvv/debug-info-rvv-dbg-value.mir (revision 806761a7629df268c8aed49657aeccffa6bca449)
1# RUN: llc -mtriple=riscv64 -mattr=+v -o %t0 -filetype=obj \
2# RUN:   -start-before=prologepilog %s
3# RUN: llc -mtriple=riscv64 -mattr=+v -o %t1 -filetype=obj \
4# RUN:   -frame-pointer=all -start-before=prologepilog %s
5# RUN: llvm-dwarfdump --name="value0" %t0 | FileCheck %s --check-prefix=CHECK0-PLUS
6# RUN: llvm-dwarfdump --name="value1" %t0 | FileCheck %s --check-prefix=CHECK1-PLUS
7# RUN: llvm-dwarfdump --name="value2" %t0 | FileCheck %s --check-prefix=CHECK2-PLUS
8# RUN: llvm-dwarfdump --name="value3" %t0 | FileCheck %s --check-prefix=CHECK3-PLUS
9# RUN: llvm-dwarfdump --name="value4" %t0 | FileCheck %s --check-prefix=CHECK4-PLUS
10# RUN: llvm-dwarfdump --name="value5" %t0 | FileCheck %s --check-prefix=CHECK5-PLUS
11# RUN: llvm-dwarfdump --name="value0" %t1 | FileCheck %s --check-prefix=CHECK0-MINUS
12# RUN: llvm-dwarfdump --name="value1" %t1 | FileCheck %s --check-prefix=CHECK1-MINUS
13# RUN: llvm-dwarfdump --name="value2" %t1 | FileCheck %s --check-prefix=CHECK2-MINUS
14# RUN: llvm-dwarfdump --name="value3" %t1 | FileCheck %s --check-prefix=CHECK3-MINUS
15# RUN: llvm-dwarfdump --name="value4" %t1 | FileCheck %s --check-prefix=CHECK4-MINUS
16# RUN: llvm-dwarfdump --name="value5" %t1 | FileCheck %s --check-prefix=CHECK5-MINUS
17
18# CHECK0-PLUS: : DW_OP_breg2 X2+24)
19# CHECK0-PLUS: DW_AT_type {{.*}}int32_t
20#
21# CHECK1-PLUS: : DW_OP_breg2 X2+16)
22# CHECK1-PLUS: DW_AT_type {{.*}}int32_t
23#
24# CHECK2-PLUS: : DW_OP_breg2 X2+32, DW_OP_lit3, DW_OP_bregx VLENB+0, DW_OP_mul, DW_OP_plus)
25# CHECK2-PLUS: DW_AT_type {{.*}}vint32m1_t
26#
27# CHECK3-PLUS: : DW_OP_breg2 X2+32, DW_OP_lit2, DW_OP_bregx VLENB+0, DW_OP_mul, DW_OP_plus)
28# CHECK3-PLUS: DW_AT_type {{.*}}vint32m1_t
29#
30# CHECK4-PLUS: : DW_OP_breg2 X2+32, DW_OP_lit1, DW_OP_bregx VLENB+0, DW_OP_mul, DW_OP_plus)
31# CHECK4-PLUS: DW_AT_type {{.*}}vbool1_t
32#
33# CHECK5-PLUS: : DW_OP_breg2 X2+32)
34# CHECK5-PLUS: DW_AT_type {{.*}}vbool1_t
35
36# CHECK0-MINUS: : DW_OP_breg8 X8-40)
37# CHECK0-MINUS: DW_AT_type {{.*}}int32_t
38#
39# CHECK1-MINUS: : DW_OP_breg8 X8-48)
40# CHECK1-MINUS: DW_AT_type {{.*}}int32_t
41#
42# CHECK2-MINUS: : DW_OP_breg8 X8-48, DW_OP_lit1, DW_OP_bregx VLENB+0, DW_OP_mul, DW_OP_minus)
43# CHECK2-MINUS: DW_AT_type {{.*}}vint32m1_t
44#
45# CHECK3-MINUS: : DW_OP_breg8 X8-48, DW_OP_lit2, DW_OP_bregx VLENB+0, DW_OP_mul, DW_OP_minus)
46# CHECK3-MINUS: DW_AT_type {{.*}}vint32m1_t
47#
48# CHECK4-MINUS: : DW_OP_breg8 X8-48, DW_OP_lit3, DW_OP_bregx VLENB+0, DW_OP_mul, DW_OP_minus)
49# CHECK4-MINUS: DW_AT_type {{.*}}vbool1_t
50#
51# CHECK5-MINUS: : DW_OP_breg8 X8-48, DW_OP_lit4, DW_OP_bregx VLENB+0, DW_OP_mul, DW_OP_minus)
52# CHECK5-MINUS: DW_AT_type {{.*}}vbool1_t
53
54--- |
55  define void @foo() !dbg !5 {
56  entry:
57    unreachable, !dbg !8
58  }
59
60  ; Function Attrs: nounwind readnone speculatable willreturn
61  declare void @llvm.dbg.value(metadata, metadata, metadata)
62
63  !llvm.dbg.cu = !{!0}
64  !llvm.debugify = !{!3, !3}
65  !llvm.module.flags = !{!4}
66
67  !0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
68  !1 = !DIFile(filename: "debug-info-rvv-dbg-value.mir", directory: "/")
69  !2 = !{}
70  !3 = !{i32 1}
71  !4 = !{i32 2, !"Debug Info Version", i32 3}
72  !5 = distinct !DISubprogram(name: "foo", linkageName: "foo", scope: null, file: !1, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !9)
73  !6 = !DISubroutineType(types: !2)
74  !7 = !DIBasicType(name: "int32_t", size: 32, encoding: DW_ATE_signed)
75  !8 = !DILocation(line: 1, column: 1, scope: !5)
76  !9 = !{!10, !11, !12, !13, !14, !15}
77  !10 = !DILocalVariable(name: "value0", scope: !5, file: !1, line: 1, type: !7)
78  !11 = !DILocalVariable(name: "value1", scope: !5, file: !1, line: 1, type: !7)
79  !12 = !DILocalVariable(name: "value2", scope: !5, file: !1, line: 1, type: !16)
80  !13 = !DILocalVariable(name: "value3", scope: !5, file: !1, line: 1, type: !16)
81  !14 = !DILocalVariable(name: "value4", scope: !5, file: !1, line: 1, type: !21)
82  !15 = !DILocalVariable(name: "value5", scope: !5, file: !1, line: 1, type: !21)
83  !16 = !DIDerivedType(tag: DW_TAG_typedef, name: "vint32m1_t", file: !1, line: 1, baseType: !17)
84  !17 = !DIDerivedType(tag: DW_TAG_typedef, name: "__rvv_int32m1_t", file: !1, baseType: !18)
85  !18 = !DICompositeType(tag: DW_TAG_array_type, baseType: !7, flags: DIFlagVector, elements: !19)
86  !19 = !{!20}
87  !20 = !DISubrange(lowerBound: 0, upperBound: !DIExpression(DW_OP_bregx, 7202, 0, DW_OP_constu, 4, DW_OP_div, DW_OP_constu, 1, DW_OP_mul))
88  !21 = !DIDerivedType(tag: DW_TAG_typedef, name: "vbool1_t", file: !1, line: 90, baseType: !22)
89  !22 = !DIDerivedType(tag: DW_TAG_typedef, name: "__rvv_bool1_t", file: !1, baseType: !23)
90  !23 = !DICompositeType(tag: DW_TAG_array_type, baseType: !24, flags: DIFlagVector, elements: !25)
91  !24 = !DIBasicType(name: "_Bool", size: 8, encoding: DW_ATE_boolean)
92  !25 = !{!26}
93  !26 = !DISubrange(lowerBound: 0, upperBound: !DIExpression(DW_OP_bregx, 7202, 0, DW_OP_constu, 1, DW_OP_div, DW_OP_constu, 1, DW_OP_mul))
94
95
96...
97---
98name:            foo
99alignment:       4
100tracksRegLiveness: true
101liveins:
102  - { reg: '$x12' }
103  - { reg: '$x13' }
104  - { reg: '$v8' }
105  - { reg: '$v9' }
106  - { reg: '$v0' }
107  - { reg: '$v1' }
108frameInfo:
109  maxAlignment:    16
110  adjustsStack:    true
111  hasCalls:        true
112  maxCallFrameSize: 0
113  localFrameSize:  4
114stack:
115  - { id: 0, size: 8, alignment: 8 }
116  - { id: 1, size: 8, alignment: 8 }
117  - { id: 2, size: 8, alignment: 4, stack-id: scalable-vector }
118  - { id: 3, size: 8, alignment: 4, stack-id: scalable-vector }
119  - { id: 4, size: 8, alignment: 1, stack-id: scalable-vector }
120  - { id: 5, size: 8, alignment: 1, stack-id: scalable-vector }
121machineFunctionInfo: {}
122body:             |
123  bb.0.entry:
124    liveins: $x12, $x13, $v8, $v9, $v0, $v1
125
126    SD killed renamable $x12, %stack.0, 0, debug-location !8
127    DBG_VALUE %stack.0, $noreg, !10, !DIExpression(DW_OP_deref), debug-location !8
128    SD killed renamable $x13, %stack.1, 0, debug-location !8
129    DBG_VALUE %stack.1, $noreg, !11, !DIExpression(DW_OP_deref), debug-location !8
130
131    PseudoVSE32_V_M1 killed renamable $v8, %stack.2, 8, 5, debug-location !DILocation(line: 5, column: 1, scope: !5)
132    DBG_VALUE %stack.2, $noreg, !12, !DIExpression(DW_OP_deref), debug-location !DILocation(line: 5, column: 1, scope: !5)
133    PseudoVSE32_V_M1 killed renamable $v9, %stack.3, 8, 5, debug-location !DILocation(line: 6, column: 1, scope: !5)
134    DBG_VALUE %stack.3, $noreg, !13, !DIExpression(DW_OP_deref), debug-location !DILocation(line: 6, column: 1, scope: !5)
135
136    PseudoVSM_V_B64 killed renamable $v0, %stack.4, 8, 0, debug-location !DILocation(line: 2, column: 1, scope: !5)
137    DBG_VALUE %stack.4, $noreg, !14, !DIExpression(DW_OP_deref), debug-location !DILocation(line: 2, column: 1, scope: !5)
138    PseudoVSM_V_B64 killed renamable $v1, %stack.5, 8, 0, debug-location !DILocation(line: 3, column: 1, scope: !5)
139    DBG_VALUE %stack.5, $noreg, !15, !DIExpression(DW_OP_deref), debug-location !DILocation(line: 3, column: 1, scope: !5)
140
141    PseudoRET
142
143...
144