1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=thumbv8.1m.main %s -run-pass=arm-cp-islands --verify-machineinstrs -o - | FileCheck %s --check-prefix=CHECK-LOB
3 # RUN: llc -mtriple=thumbv8.1m.main -mattr=-lob %s -run-pass=arm-cp-islands --verify-machineinstrs -o - | FileCheck %s --check-prefix=CHECK-NOLOB
6 target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
7 target triple = "thumbv8.1m.main-unknown-unknown"
9 %struct.head_s = type { %struct.head_s*, %struct.data_s* }
10 %struct.data_s = type { i16, i16 }
12 ; Function Attrs: norecurse nounwind readonly
13 define dso_local arm_aapcscc %struct.head_s* @search(%struct.head_s* readonly %list, %struct.data_s* nocapture readonly %info) local_unnamed_addr {
15 %idx = getelementptr inbounds %struct.data_s, %struct.data_s* %info, i32 0, i32 1
16 %0 = load i16, i16* %idx, align 2
17 %cmp = icmp sgt i16 %0, -1
18 br i1 %cmp, label %while.cond.preheader, label %while.cond9.preheader
20 while.cond9.preheader: ; preds = %entry
21 %1 = icmp eq %struct.head_s* %list, null
22 br i1 %1, label %return, label %land.rhs11.lr.ph
24 land.rhs11.lr.ph: ; preds = %while.cond9.preheader
25 %data16143 = bitcast %struct.data_s* %info to i16*
26 %2 = load i16, i16* %data16143, align 2
27 %conv15 = sext i16 %2 to i32
30 while.cond.preheader: ; preds = %entry
31 %3 = icmp eq %struct.head_s* %list, null
32 br i1 %3, label %return, label %land.rhs.preheader
34 land.rhs.preheader: ; preds = %while.cond.preheader
37 land.rhs: ; preds = %land.rhs.preheader, %while.body
38 %list.addr.033 = phi %struct.head_s* [ %6, %while.body ], [ %list, %land.rhs.preheader ]
39 %info2 = getelementptr inbounds %struct.head_s, %struct.head_s* %list.addr.033, i32 0, i32 1
40 %4 = load %struct.data_s*, %struct.data_s** %info2, align 4
41 %idx3 = getelementptr inbounds %struct.data_s, %struct.data_s* %4, i32 0, i32 1
42 %5 = load i16, i16* %idx3, align 2
43 %cmp7 = icmp eq i16 %5, %0
44 br i1 %cmp7, label %return, label %while.body
46 while.body: ; preds = %land.rhs
47 %next4 = bitcast %struct.head_s* %list.addr.033 to %struct.head_s**
48 %6 = load %struct.head_s*, %struct.head_s** %next4, align 4
49 %tobool = icmp eq %struct.head_s* %6, null
50 br i1 %tobool, label %return, label %land.rhs
52 land.rhs11: ; preds = %while.body19, %land.rhs11.lr.ph
53 %list.addr.136 = phi %struct.head_s* [ %list, %land.rhs11.lr.ph ], [ %10, %while.body19 ]
54 %info12 = getelementptr inbounds %struct.head_s, %struct.head_s* %list.addr.136, i32 0, i32 1
55 %7 = load %struct.data_s*, %struct.data_s** %info12, align 4
56 %data165 = bitcast %struct.data_s* %7 to i16*
57 %8 = load i16, i16* %data165, align 2
59 %and = zext i16 %9 to i32
60 %cmp16 = icmp eq i32 %and, %conv15
61 br i1 %cmp16, label %return, label %while.body19
63 while.body19: ; preds = %land.rhs11
64 %next206 = bitcast %struct.head_s* %list.addr.136 to %struct.head_s**
65 %10 = load %struct.head_s*, %struct.head_s** %next206, align 4
66 %tobool10 = icmp eq %struct.head_s* %10, null
67 br i1 %tobool10, label %return, label %land.rhs11
69 return: ; preds = %while.body19, %land.rhs11, %while.body, %land.rhs, %while.cond.preheader, %while.cond9.preheader
70 %retval.0 = phi %struct.head_s* [ null, %while.cond.preheader ], [ null, %while.cond9.preheader ], [ %list.addr.033, %land.rhs ], [ null, %while.body ], [ %list.addr.136, %land.rhs11 ], [ null, %while.body19 ]
71 ret %struct.head_s* %retval.0
78 exposesReturnsTwice: false
80 regBankSelected: false
83 tracksRegLiveness: true
87 - { reg: '$r0', virtual-reg: '' }
88 - { reg: '$r1', virtual-reg: '' }
90 isFrameAddressTaken: false
91 isReturnAddressTaken: false
101 cvBytesOfCalleeSavedRegisters: 0
102 hasOpaqueSPAdjustment: false
104 hasMustTailInVarArgFunc: false
112 machineFunctionInfo: {}
114 ; CHECK-LOB-LABEL: name: search
115 ; CHECK-LOB: bb.0.entry:
116 ; CHECK-LOB: successors: %bb.1(0x50000000), %bb.5(0x30000000)
117 ; CHECK-LOB: liveins: $r0, $r1
118 ; CHECK-LOB: renamable $r2 = t2LDRSHi12 renamable $r1, 2, 14 /* CC::al */, $noreg :: (load (s16) from %ir.idx)
119 ; CHECK-LOB: t2CMPri renamable $r2, -1, 14 /* CC::al */, $noreg, implicit-def $cpsr
120 ; CHECK-LOB: tBcc %bb.5, 13 /* CC::le */, killed $cpsr
121 ; CHECK-LOB: bb.1.while.cond.preheader:
122 ; CHECK-LOB: successors: %bb.9(0x30000000), %bb.2(0x50000000)
123 ; CHECK-LOB: liveins: $r0, $r2
124 ; CHECK-LOB: tCBZ renamable $r0, %bb.9
125 ; CHECK-LOB: bb.2.land.rhs.preheader:
126 ; CHECK-LOB: successors: %bb.3(0x80000000)
127 ; CHECK-LOB: liveins: $r0, $r2
128 ; CHECK-LOB: renamable $r1 = tUXTH killed renamable $r2, 14 /* CC::al */, $noreg
129 ; CHECK-LOB: bb.3.land.rhs:
130 ; CHECK-LOB: successors: %bb.4(0x80000000)
131 ; CHECK-LOB: liveins: $r0, $r1
132 ; CHECK-LOB: renamable $r2 = tLDRi renamable $r0, 1, 14 /* CC::al */, $noreg :: (load (s32) from %ir.info2)
133 ; CHECK-LOB: renamable $r2 = tLDRHi killed renamable $r2, 1, 14 /* CC::al */, $noreg :: (load (s16) from %ir.idx3)
134 ; CHECK-LOB: tCMPr killed renamable $r2, renamable $r1, 14 /* CC::al */, $noreg, implicit-def $cpsr
135 ; CHECK-LOB: t2IT 0, 8, implicit-def $itstate
136 ; CHECK-LOB: tBX_RET 0 /* CC::eq */, killed $cpsr, implicit $r0, implicit killed $itstate
137 ; CHECK-LOB: bb.4.while.body:
138 ; CHECK-LOB: successors: %bb.9(0x04000000), %bb.3(0x7c000000)
139 ; CHECK-LOB: liveins: $r0, $r1
140 ; CHECK-LOB: renamable $r0 = tLDRi killed renamable $r0, 0, 14 /* CC::al */, $noreg :: (load (s32) from %ir.next4)
141 ; CHECK-LOB: tCBZ renamable $r0, %bb.9
142 ; CHECK-LOB: t2LE %bb.3
143 ; CHECK-LOB: bb.5.while.cond9.preheader:
144 ; CHECK-LOB: successors: %bb.9(0x30000000), %bb.6(0x50000000)
145 ; CHECK-LOB: liveins: $r0, $r1
146 ; CHECK-LOB: tCBZ renamable $r0, %bb.9
147 ; CHECK-LOB: bb.6.land.rhs11.lr.ph:
148 ; CHECK-LOB: successors: %bb.7(0x80000000)
149 ; CHECK-LOB: liveins: $r0, $r1
150 ; CHECK-LOB: renamable $r1 = t2LDRSHi12 killed renamable $r1, 0, 14 /* CC::al */, $noreg :: (load (s16) from %ir.data16143)
151 ; CHECK-LOB: bb.7.land.rhs11:
152 ; CHECK-LOB: successors: %bb.10(0x04000000), %bb.8(0x7c000000)
153 ; CHECK-LOB: liveins: $r0, $r1
154 ; CHECK-LOB: renamable $r2 = tLDRi renamable $r0, 1, 14 /* CC::al */, $noreg :: (load (s32) from %ir.info12)
155 ; CHECK-LOB: renamable $r2 = tLDRBi killed renamable $r2, 0, 14 /* CC::al */, $noreg :: (load (s8) from %ir.data165, align 2)
156 ; CHECK-LOB: tCMPr killed renamable $r2, renamable $r1, 14 /* CC::al */, $noreg, implicit-def $cpsr
157 ; CHECK-LOB: tBcc %bb.10, 0 /* CC::eq */, killed $cpsr
158 ; CHECK-LOB: bb.8.while.body19:
159 ; CHECK-LOB: successors: %bb.9(0x04000000), %bb.7(0x7c000000)
160 ; CHECK-LOB: liveins: $r0, $r1
161 ; CHECK-LOB: renamable $r0 = tLDRi killed renamable $r0, 0, 14 /* CC::al */, $noreg :: (load (s32) from %ir.next206)
162 ; CHECK-LOB: tCBZ renamable $r0, %bb.9
163 ; CHECK-LOB: t2LE %bb.7
165 ; CHECK-LOB: successors: %bb.10(0x80000000)
166 ; CHECK-LOB: renamable $r0, dead $cpsr = tMOVi8 0, 14 /* CC::al */, $noreg
167 ; CHECK-LOB: bb.10.return:
168 ; CHECK-LOB: liveins: $r0
169 ; CHECK-LOB: tBX_RET 14 /* CC::al */, $noreg, implicit killed $r0
170 ; CHECK-NOLOB-LABEL: name: search
171 ; CHECK-NOLOB: bb.0.entry:
172 ; CHECK-NOLOB: successors: %bb.1(0x50000000), %bb.5(0x30000000)
173 ; CHECK-NOLOB: liveins: $r0, $r1
174 ; CHECK-NOLOB: renamable $r2 = t2LDRSHi12 renamable $r1, 2, 14 /* CC::al */, $noreg :: (load (s16) from %ir.idx)
175 ; CHECK-NOLOB: t2CMPri renamable $r2, -1, 14 /* CC::al */, $noreg, implicit-def $cpsr
176 ; CHECK-NOLOB: tBcc %bb.5, 13 /* CC::le */, killed $cpsr
177 ; CHECK-NOLOB: bb.1.while.cond.preheader:
178 ; CHECK-NOLOB: successors: %bb.9(0x30000000), %bb.2(0x50000000)
179 ; CHECK-NOLOB: liveins: $r0, $r2
180 ; CHECK-NOLOB: tCBZ renamable $r0, %bb.9
181 ; CHECK-NOLOB: bb.2.land.rhs.preheader:
182 ; CHECK-NOLOB: successors: %bb.3(0x80000000)
183 ; CHECK-NOLOB: liveins: $r0, $r2
184 ; CHECK-NOLOB: renamable $r1 = tUXTH killed renamable $r2, 14 /* CC::al */, $noreg
185 ; CHECK-NOLOB: bb.3.land.rhs:
186 ; CHECK-NOLOB: successors: %bb.4(0x80000000)
187 ; CHECK-NOLOB: liveins: $r0, $r1
188 ; CHECK-NOLOB: renamable $r2 = tLDRi renamable $r0, 1, 14 /* CC::al */, $noreg :: (load (s32) from %ir.info2)
189 ; CHECK-NOLOB: renamable $r2 = tLDRHi killed renamable $r2, 1, 14 /* CC::al */, $noreg :: (load (s16) from %ir.idx3)
190 ; CHECK-NOLOB: tCMPr killed renamable $r2, renamable $r1, 14 /* CC::al */, $noreg, implicit-def $cpsr
191 ; CHECK-NOLOB: t2IT 0, 8, implicit-def $itstate
192 ; CHECK-NOLOB: tBX_RET 0 /* CC::eq */, killed $cpsr, implicit $r0, implicit killed $itstate
193 ; CHECK-NOLOB: bb.4.while.body:
194 ; CHECK-NOLOB: successors: %bb.9(0x04000000), %bb.3(0x7c000000)
195 ; CHECK-NOLOB: liveins: $r0, $r1
196 ; CHECK-NOLOB: renamable $r0 = tLDRi killed renamable $r0, 0, 14 /* CC::al */, $noreg :: (load (s32) from %ir.next4)
197 ; CHECK-NOLOB: tCMPi8 renamable $r0, 0, 14 /* CC::al */, $noreg, implicit-def $cpsr
198 ; CHECK-NOLOB: tBcc %bb.3, 1 /* CC::ne */, killed $cpsr
199 ; CHECK-NOLOB: tB %bb.9, 14 /* CC::al */, $noreg
200 ; CHECK-NOLOB: bb.5.while.cond9.preheader:
201 ; CHECK-NOLOB: successors: %bb.9(0x30000000), %bb.6(0x50000000)
202 ; CHECK-NOLOB: liveins: $r0, $r1
203 ; CHECK-NOLOB: tCBZ renamable $r0, %bb.9
204 ; CHECK-NOLOB: bb.6.land.rhs11.lr.ph:
205 ; CHECK-NOLOB: successors: %bb.7(0x80000000)
206 ; CHECK-NOLOB: liveins: $r0, $r1
207 ; CHECK-NOLOB: renamable $r1 = t2LDRSHi12 killed renamable $r1, 0, 14 /* CC::al */, $noreg :: (load (s16) from %ir.data16143)
208 ; CHECK-NOLOB: bb.7.land.rhs11:
209 ; CHECK-NOLOB: successors: %bb.10(0x04000000), %bb.8(0x7c000000)
210 ; CHECK-NOLOB: liveins: $r0, $r1
211 ; CHECK-NOLOB: renamable $r2 = tLDRi renamable $r0, 1, 14 /* CC::al */, $noreg :: (load (s32) from %ir.info12)
212 ; CHECK-NOLOB: renamable $r2 = tLDRBi killed renamable $r2, 0, 14 /* CC::al */, $noreg :: (load (s8) from %ir.data165, align 2)
213 ; CHECK-NOLOB: tCMPr killed renamable $r2, renamable $r1, 14 /* CC::al */, $noreg, implicit-def $cpsr
214 ; CHECK-NOLOB: tBcc %bb.10, 0 /* CC::eq */, killed $cpsr
215 ; CHECK-NOLOB: bb.8.while.body19:
216 ; CHECK-NOLOB: successors: %bb.9(0x04000000), %bb.7(0x7c000000)
217 ; CHECK-NOLOB: liveins: $r0, $r1
218 ; CHECK-NOLOB: renamable $r0 = tLDRi killed renamable $r0, 0, 14 /* CC::al */, $noreg :: (load (s32) from %ir.next206)
219 ; CHECK-NOLOB: tCMPi8 renamable $r0, 0, 14 /* CC::al */, $noreg, implicit-def $cpsr
220 ; CHECK-NOLOB: tBcc %bb.7, 1 /* CC::ne */, killed $cpsr
222 ; CHECK-NOLOB: successors: %bb.10(0x80000000)
223 ; CHECK-NOLOB: renamable $r0, dead $cpsr = tMOVi8 0, 14 /* CC::al */, $noreg
224 ; CHECK-NOLOB: bb.10.return:
225 ; CHECK-NOLOB: liveins: $r0
226 ; CHECK-NOLOB: tBX_RET 14 /* CC::al */, $noreg, implicit killed $r0
228 successors: %bb.5(0x50000000), %bb.1(0x30000000)
231 renamable $r2 = t2LDRSHi12 renamable $r1, 2, 14, $noreg :: (load (s16) from %ir.idx)
232 t2CMPri renamable $r2, -1, 14, $noreg, implicit-def $cpsr
233 t2Bcc %bb.1, 13, killed $cpsr
235 bb.5.while.cond.preheader:
236 successors: %bb.8(0x30000000), %bb.6(0x50000000)
239 tCMPi8 renamable $r0, 0, 14, $noreg, implicit-def $cpsr
240 t2Bcc %bb.8, 0, killed $cpsr
242 bb.6.land.rhs.preheader:
243 successors: %bb.7(0x80000000)
246 renamable $r1 = tUXTH killed renamable $r2, 14, $noreg
249 successors: %bb.10(0x80000000)
252 renamable $r2 = tLDRi renamable $r0, 1, 14, $noreg :: (load (s32) from %ir.info2)
253 renamable $r2 = tLDRHi killed renamable $r2, 1, 14, $noreg :: (load (s16) from %ir.idx3)
254 tCMPr killed renamable $r2, renamable $r1, 14, $noreg, implicit-def $cpsr
255 t2IT 0, 8, implicit-def $itstate
256 tBX_RET 0, killed $cpsr, implicit $r0, implicit killed $itstate
259 successors: %bb.8(0x04000000), %bb.7(0x7c000000)
262 renamable $r0 = tLDRi killed renamable $r0, 0, 14, $noreg :: (load (s32) from %ir.next4)
263 tCMPi8 renamable $r0, 0, 14, $noreg, implicit-def $cpsr
264 t2Bcc %bb.7, 1, killed $cpsr
265 t2B %bb.8, 14, $noreg
267 bb.1.while.cond9.preheader:
268 successors: %bb.8(0x30000000), %bb.2(0x50000000)
271 tCMPi8 renamable $r0, 0, 14, $noreg, implicit-def $cpsr
272 t2Bcc %bb.8, 0, killed $cpsr
274 bb.2.land.rhs11.lr.ph:
275 successors: %bb.3(0x80000000)
278 renamable $r1 = t2LDRSHi12 killed renamable $r1, 0, 14, $noreg :: (load (s16) from %ir.data16143)
281 successors: %bb.9(0x04000000), %bb.4(0x7c000000)
284 renamable $r2 = tLDRi renamable $r0, 1, 14, $noreg :: (load (s32) from %ir.info12)
285 renamable $r2 = tLDRBi killed renamable $r2, 0, 14, $noreg :: (load (s8) from %ir.data165, align 2)
286 tCMPr killed renamable $r2, renamable $r1, 14, $noreg, implicit-def $cpsr
287 t2Bcc %bb.9, 0, killed $cpsr
290 successors: %bb.8(0x04000000), %bb.3(0x7c000000)
293 renamable $r0 = tLDRi killed renamable $r0, 0, 14, $noreg :: (load (s32) from %ir.next206)
294 tCMPi8 renamable $r0, 0, 14, $noreg, implicit-def $cpsr
295 t2Bcc %bb.3, 1, killed $cpsr
298 successors: %bb.9(0x80000000)
300 renamable $r0, dead $cpsr = tMOVi8 0, 14, $noreg
305 tBX_RET 14, $noreg, implicit killed $r0