xref: /llvm-project/llvm/test/CodeGen/ARM/ARMLoadStoreDBG.mir (revision 60442f0d442723a487528bdd8b48b24657a025e8)
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -mtriple thumbv7 -verify-machineinstrs -run-pass arm-ldst-opt %s -o - | FileCheck %s
3--- |
4  ; ModuleID = '/Volumes/Data/llvm/test/CodeGen/ARM/sched-it-debug-nodes.ll'
5  target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
6  target triple = "thumbv7"
7
8  %struct.s = type opaque
9
10  ; Function Attrs: nounwind
11  define arm_aapcscc i32 @f(ptr %s, i32 %u, ptr %b, i32 %n) #0 !dbg !4 {
12  entry:
13    tail call void @llvm.dbg.value(metadata ptr %s, i64 0, metadata !18, metadata !27), !dbg !28
14    tail call void @llvm.dbg.value(metadata i32 %u, i64 0, metadata !19, metadata !27), !dbg !28
15    tail call void @llvm.dbg.value(metadata ptr %b, i64 0, metadata !20, metadata !27), !dbg !28
16    tail call void @llvm.dbg.value(metadata i32 %n, i64 0, metadata !21, metadata !27), !dbg !28
17    %cmp = icmp ult i32 %n, 4, !dbg !29
18    br i1 %cmp, label %return, label %if.end, !dbg !31
19
20  if.end:                                           ; preds = %entry
21    tail call arm_aapcscc void @g(ptr %s, ptr %b, i32 %n) #3, !dbg !32
22    br label %return, !dbg !33
23
24  return:                                           ; preds = %if.end, %entry
25    %retval.0 = phi i32 [ 0, %if.end ], [ -1, %entry ]
26    ret i32 %retval.0, !dbg !34
27  }
28
29  declare arm_aapcscc void @g(ptr, ptr, i32) #1
30
31  ; Function Attrs: nounwind readnone
32  declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #2
33
34  attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
35  attributes #1 = { "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
36  attributes #2 = { nounwind readnone }
37  attributes #3 = { nounwind }
38
39  !llvm.dbg.cu = !{!0}
40  !llvm.module.flags = !{!22, !23, !24, !25}
41  !llvm.ident = !{!26}
42
43  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.7.0  (llvm/trunk 237059)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
44  !1 = !DIFile(filename: "<stdin>", directory: "/Users/compnerd/Source/llvm")
45  !2 = !{}
46  !4 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 9, type: !5, isLocal: false, isDefinition: true, scopeLine: 9, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !17)
47  !5 = !DISubroutineType(types: !6)
48  !6 = !{!7, !8, !11, !12, !16}
49  !7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
50  !8 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !9, size: 32, align: 32)
51  !9 = !DIDerivedType(tag: DW_TAG_typedef, name: "s", file: !1, line: 5, baseType: !10)
52  !10 = !DICompositeType(tag: DW_TAG_structure_type, name: "s", file: !1, line: 5, flags: DIFlagFwdDecl)
53  !11 = !DIBasicType(name: "unsigned int", size: 32, align: 32, encoding: DW_ATE_unsigned)
54  !12 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !13, size: 32, align: 32)
55  !13 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !14)
56  !14 = !DIDerivedType(tag: DW_TAG_typedef, name: "uint8_t", file: !1, line: 2, baseType: !15)
57  !15 = !DIBasicType(name: "unsigned char", size: 8, align: 8, encoding: DW_ATE_unsigned_char)
58  !16 = !DIDerivedType(tag: DW_TAG_typedef, name: "size_t", file: !1, line: 3, baseType: !11)
59  !17 = !{!18, !19, !20, !21}
60  !18 = !DILocalVariable(name: "s", arg: 1, scope: !4, file: !1, line: 9, type: !8)
61  !19 = !DILocalVariable(name: "u", arg: 2, scope: !4, file: !1, line: 9, type: !11)
62  !20 = !DILocalVariable(name: "b", arg: 3, scope: !4, file: !1, line: 9, type: !12)
63  !21 = !DILocalVariable(name: "n", arg: 4, scope: !4, file: !1, line: 9, type: !16)
64  !22 = !{i32 2, !"Dwarf Version", i32 4}
65  !23 = !{i32 2, !"Debug Info Version", i32 3}
66  !24 = !{i32 1, !"wchar_size", i32 4}
67  !25 = !{i32 1, !"min_enum_size", i32 4}
68  !26 = !{!"clang version 3.7.0  (llvm/trunk 237059)"}
69  !27 = !DIExpression()
70  !28 = !DILocation(line: 9, scope: !4)
71  !29 = !DILocation(line: 10, scope: !30)
72  !30 = distinct !DILexicalBlock(scope: !4, file: !1, line: 10)
73  !31 = !DILocation(line: 10, scope: !4)
74  !32 = !DILocation(line: 13, scope: !4)
75  !33 = !DILocation(line: 14, scope: !4)
76  !34 = !DILocation(line: 15, scope: !4)
77
78...
79---
80name:            f
81alignment:       2
82exposesReturnsTwice: false
83tracksRegLiveness: true
84liveins:
85  - { reg: '$r0' }
86  - { reg: '$r1' }
87  - { reg: '$r2' }
88  - { reg: '$r3' }
89calleeSavedRegisters: [ '$lr', '$d8', '$d9', '$d10', '$d11', '$d12', '$d13',
90                        '$d14', '$d15', '$q4', '$q5', '$q6', '$q7', '$r4',
91                        '$r5', '$r6', '$r7', '$r8', '$r9', '$r10', '$r11',
92                        '$s16', '$s17', '$s18', '$s19', '$s20', '$s21',
93                        '$s22', '$s23', '$s24', '$s25', '$s26', '$s27',
94                        '$s28', '$s29', '$s30', '$s31', '$d8_d10', '$d9_d11',
95                        '$d10_d12', '$d11_d13', '$d12_d14', '$d13_d15',
96                        '$q4_q5', '$q5_q6', '$q6_q7', '$q4_q5_q6_q7', '$r4_r5',
97                        '$r6_r7', '$r8_r9', '$r10_r11', '$d8_d9_d10', '$d9_d10_d11',
98                        '$d10_d11_d12', '$d11_d12_d13', '$d12_d13_d14',
99                        '$d13_d14_d15', '$d8_d10_d12', '$d9_d11_d13', '$d10_d12_d14',
100                        '$d11_d13_d15', '$d8_d10_d12_d14', '$d9_d11_d13_d15',
101                        '$d9_d10', '$d11_d12', '$d13_d14', '$d9_d10_d11_d12',
102                        '$d11_d12_d13_d14' ]
103frameInfo:
104  isFrameAddressTaken: false
105  isReturnAddressTaken: false
106  hasStackMap:     false
107  hasPatchPoint:   false
108  stackSize:       8
109  offsetAdjustment: 0
110  maxAlignment:    4
111  adjustsStack:    true
112  hasCalls:        true
113  maxCallFrameSize: 0
114  hasOpaqueSPAdjustment: false
115  hasVAStart:      false
116  hasMustTailInVarArgFunc: false
117stack:
118  - { id: 0, type: spill-slot, offset: -4, size: 4, alignment: 4, callee-saved-register: '$lr', callee-saved-restored: false }
119  - { id: 1, type: spill-slot, offset: -8, size: 4, alignment: 4, callee-saved-register: '$r7', callee-saved-restored: true }
120body:             |
121  ; CHECK-LABEL: name: f
122  ; CHECK: bb.0.entry:
123  ; CHECK:   successors: %bb.2(0x40000000), %bb.1(0x40000000)
124  ; CHECK:   liveins: $r0, $r1, $r2, $r3, $lr, $r7
125  ; CHECK:   DBG_VALUE $r0, $noreg, !22, !DIExpression(), debug-location !26
126  ; CHECK:   DBG_VALUE $r1, $noreg, !23, !DIExpression(), debug-location !26
127  ; CHECK:   DBG_VALUE $r2, $noreg, !24, !DIExpression(), debug-location !26
128  ; CHECK:   DBG_VALUE $r3, $noreg, !25, !DIExpression(), debug-location !26
129  ; CHECK:   t2CMPri $r3, 4, 14 /* CC::al */, $noreg, implicit-def $cpsr, debug-location !29
130  ; CHECK:   t2Bcc %bb.2, 2 /* CC::hs */, killed $cpsr
131  ; CHECK: bb.1:
132  ; CHECK:   liveins: $lr, $r7
133  ; CHECK:   DBG_VALUE $r1, $noreg, !23, !DIExpression(), debug-location !26
134  ; CHECK:   $r0 = t2MOVi -1, 14 /* CC::al */, $noreg, $noreg
135  ; CHECK:   DBG_VALUE $r1, $noreg, !23, !DIExpression(), debug-location !26
136  ; CHECK:   tBX_RET 14 /* CC::al */, $noreg, implicit $r0, debug-location !32
137  ; CHECK: bb.2.if.end:
138  ; CHECK:   liveins: $r0, $r2, $r3, $r7, $lr
139  ; CHECK:   $sp = frame-setup t2STMDB_UPD $sp, 14 /* CC::al */, $noreg, killed $r7, killed $lr
140  ; CHECK:   frame-setup CFI_INSTRUCTION def_cfa_offset 8
141  ; CHECK:   frame-setup CFI_INSTRUCTION offset $lr, -4
142  ; CHECK:   frame-setup CFI_INSTRUCTION offset $r7, -8
143  ; CHECK:   DBG_VALUE $r0, $noreg, !22, !DIExpression(), debug-location !26
144  ; CHECK:   DBG_VALUE $r1, $noreg, !23, !DIExpression(), debug-location !26
145  ; CHECK:   DBG_VALUE $r2, $noreg, !24, !DIExpression(), debug-location !26
146  ; CHECK:   DBG_VALUE $r3, $noreg, !25, !DIExpression(), debug-location !26
147  ; CHECK:   $r1 = COPY killed $r2, debug-location !30
148  ; CHECK:   DBG_VALUE $r1, $noreg, !23, !DIExpression(), debug-location !26
149  ; CHECK:   $r2 = COPY killed $r3, debug-location !30
150  ; CHECK:   tBL 14 /* CC::al */, $noreg, @g, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit $r0, implicit $r1, implicit $r2, implicit-def $sp, debug-location !30
151  ; CHECK:   $r0 = t2MOVi 0, 14 /* CC::al */, $noreg, $noreg
152  ; CHECK:   $sp = t2LDMIA_RET $sp, 14 /* CC::al */, $noreg, def $r7, def $pc, implicit $r0
153  bb.0.entry:
154    liveins: $r0, $r1, $r2, $r3, $lr, $r7
155
156    DBG_VALUE $r0, $noreg, !18, !27, debug-location !28
157    DBG_VALUE $r1, $noreg, !19, !27, debug-location !28
158    DBG_VALUE $r2, $noreg, !20, !27, debug-location !28
159    DBG_VALUE $r3, $noreg, !21, !27, debug-location !28
160    t2CMPri $r3, 4, 14, $noreg, implicit-def $cpsr, debug-location !31
161    t2Bcc %bb.2.if.end, 2, killed $cpsr
162
163  bb.1:
164    liveins: $lr, $r7
165
166    DBG_VALUE $r1, $noreg, !19, !27, debug-location !28
167    $r0 = t2MOVi -1, 14, $noreg, $noreg
168    DBG_VALUE $r1, $noreg, !19, !27, debug-location !28
169    tBX_RET 14, $noreg, implicit $r0, debug-location !34
170
171  bb.2.if.end:
172    liveins: $r0, $r2, $r3, $r7, $lr
173
174    $sp = frame-setup t2STMDB_UPD $sp, 14, $noreg, killed $r7, killed $lr
175    frame-setup CFI_INSTRUCTION def_cfa_offset 8
176    frame-setup CFI_INSTRUCTION offset $lr, -4
177    frame-setup CFI_INSTRUCTION offset $r7, -8
178    DBG_VALUE $r0, $noreg, !18, !27, debug-location !28
179    DBG_VALUE $r1, $noreg, !19, !27, debug-location !28
180    DBG_VALUE $r2, $noreg, !20, !27, debug-location !28
181    DBG_VALUE $r3, $noreg, !21, !27, debug-location !28
182    $r1 = COPY killed $r2, debug-location !32
183    DBG_VALUE $r1, $noreg, !19, !27, debug-location !28
184    $r2 = COPY killed $r3, debug-location !32
185    tBL 14, $noreg, @g, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit $r0, implicit $r1, implicit $r2, implicit-def $sp, debug-location !32
186    $r0 = t2MOVi 0, 14, $noreg, $noreg
187    $sp = t2LDMIA_UPD $sp, 14, $noreg, def $r7, def $lr
188    tBX_RET 14, $noreg, implicit $r0, debug-location !34
189# Verify that the DBG_VALUE is ignored.
190
191...
192