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 { ptr, ptr }
10 %struct.data_s = type { i16, i16 }
12 define dso_local arm_aapcscc ptr @search(ptr readonly %list, ptr nocapture readonly %info) local_unnamed_addr {
14 %idx = getelementptr inbounds %struct.data_s, ptr %info, i32 0, i32 1
15 %0 = load i16, ptr %idx, align 2
16 %cmp = icmp sgt i16 %0, -1
17 br i1 %cmp, label %while.cond.preheader, label %while.cond9.preheader
19 while.cond9.preheader: ; preds = %entry
20 %1 = icmp eq ptr %list, null
21 br i1 %1, label %return, label %land.rhs11.lr.ph
23 land.rhs11.lr.ph: ; preds = %while.cond9.preheader
24 %data16143 = bitcast ptr %info to ptr
25 %2 = load i16, ptr %data16143, align 2
26 %conv15 = sext i16 %2 to i32
29 while.cond.preheader: ; preds = %entry
30 %3 = icmp eq ptr %list, null
31 br i1 %3, label %return, label %land.rhs.preheader
33 land.rhs.preheader: ; preds = %while.cond.preheader
36 land.rhs: ; preds = %land.rhs.preheader, %while.body
37 %list.addr.033 = phi ptr [ %6, %while.body ], [ %list, %land.rhs.preheader ]
38 %info2 = getelementptr inbounds %struct.head_s, ptr %list.addr.033, i32 0, i32 1
39 %4 = load ptr, ptr %info2, align 4
40 %idx3 = getelementptr inbounds %struct.data_s, ptr %4, i32 0, i32 1
41 %5 = load i16, ptr %idx3, align 2
42 %cmp7 = icmp eq i16 %5, %0
43 br i1 %cmp7, label %return, label %while.body
45 while.body: ; preds = %land.rhs
46 %next4 = bitcast ptr %list.addr.033 to ptr
47 %6 = load ptr, ptr %next4, align 4
48 %tobool = icmp eq ptr %6, null
49 br i1 %tobool, label %return, label %land.rhs
51 land.rhs11: ; preds = %while.body19, %land.rhs11.lr.ph
52 %list.addr.136 = phi ptr [ %list, %land.rhs11.lr.ph ], [ %10, %while.body19 ]
53 %info12 = getelementptr inbounds %struct.head_s, ptr %list.addr.136, i32 0, i32 1
54 %7 = load ptr, ptr %info12, align 4
55 %data165 = bitcast ptr %7 to ptr
56 %8 = load i16, ptr %data165, align 2
58 %and = zext i16 %9 to i32
59 %cmp16 = icmp eq i32 %and, %conv15
60 br i1 %cmp16, label %return, label %while.body19
62 while.body19: ; preds = %land.rhs11
63 %next206 = bitcast ptr %list.addr.136 to ptr
64 %10 = load ptr, ptr %next206, align 4
65 %tobool10 = icmp eq ptr %10, null
66 br i1 %tobool10, label %return, label %land.rhs11
68 return: ; preds = %while.body19, %land.rhs11, %while.body, %land.rhs, %while.cond.preheader, %while.cond9.preheader
69 %retval.0 = phi ptr [ null, %while.cond.preheader ], [ null, %while.cond9.preheader ], [ %list.addr.033, %land.rhs ], [ null, %while.body ], [ %list.addr.136, %land.rhs11 ], [ null, %while.body19 ]
77 exposesReturnsTwice: false
79 regBankSelected: false
82 tracksRegLiveness: true
86 - { reg: '$r0', virtual-reg: '' }
87 - { reg: '$r1', virtual-reg: '' }
89 isFrameAddressTaken: false
90 isReturnAddressTaken: false
100 cvBytesOfCalleeSavedRegisters: 0
101 hasOpaqueSPAdjustment: false
103 hasMustTailInVarArgFunc: false
111 machineFunctionInfo: {}
113 ; CHECK-LOB-LABEL: name: search
114 ; CHECK-LOB: bb.0.entry:
115 ; CHECK-LOB-NEXT: successors: %bb.1(0x50000000), %bb.5(0x30000000)
116 ; CHECK-LOB-NEXT: liveins: $r0, $r1
117 ; CHECK-LOB-NEXT: {{ $}}
118 ; CHECK-LOB-NEXT: renamable $r2 = t2LDRSHi12 renamable $r1, 2, 14 /* CC::al */, $noreg :: (load (s16) from %ir.idx)
119 ; CHECK-LOB-NEXT: t2CMPri renamable $r2, -1, 14 /* CC::al */, $noreg, implicit-def $cpsr
120 ; CHECK-LOB-NEXT: tBcc %bb.5, 13 /* CC::le */, killed $cpsr
121 ; CHECK-LOB-NEXT: {{ $}}
122 ; CHECK-LOB-NEXT: bb.1.while.cond.preheader:
123 ; CHECK-LOB-NEXT: successors: %bb.9(0x30000000), %bb.2(0x50000000)
124 ; CHECK-LOB-NEXT: liveins: $r0, $r2
125 ; CHECK-LOB-NEXT: {{ $}}
126 ; CHECK-LOB-NEXT: tCBZ renamable $r0, %bb.9
127 ; CHECK-LOB-NEXT: {{ $}}
128 ; CHECK-LOB-NEXT: bb.2.land.rhs.preheader:
129 ; CHECK-LOB-NEXT: successors: %bb.3(0x80000000)
130 ; CHECK-LOB-NEXT: liveins: $r0, $r2
131 ; CHECK-LOB-NEXT: {{ $}}
132 ; CHECK-LOB-NEXT: renamable $r1 = tUXTH killed renamable $r2, 14 /* CC::al */, $noreg
133 ; CHECK-LOB-NEXT: {{ $}}
134 ; CHECK-LOB-NEXT: bb.3.land.rhs:
135 ; CHECK-LOB-NEXT: successors: %bb.4(0x80000000)
136 ; CHECK-LOB-NEXT: liveins: $r0, $r1
137 ; CHECK-LOB-NEXT: {{ $}}
138 ; CHECK-LOB-NEXT: renamable $r2 = tLDRi renamable $r0, 1, 14 /* CC::al */, $noreg :: (load (s32) from %ir.info2)
139 ; CHECK-LOB-NEXT: renamable $r2 = tLDRHi killed renamable $r2, 1, 14 /* CC::al */, $noreg :: (load (s16) from %ir.idx3)
140 ; CHECK-LOB-NEXT: tCMPr killed renamable $r2, renamable $r1, 14 /* CC::al */, $noreg, implicit-def $cpsr
141 ; CHECK-LOB-NEXT: t2IT 0, 8, implicit-def $itstate
142 ; CHECK-LOB-NEXT: tBX_RET 0 /* CC::eq */, killed $cpsr, implicit $r0, implicit killed $itstate
143 ; CHECK-LOB-NEXT: {{ $}}
144 ; CHECK-LOB-NEXT: bb.4.while.body:
145 ; CHECK-LOB-NEXT: successors: %bb.9(0x04000000), %bb.3(0x7c000000)
146 ; CHECK-LOB-NEXT: liveins: $r0, $r1
147 ; CHECK-LOB-NEXT: {{ $}}
148 ; CHECK-LOB-NEXT: renamable $r0 = tLDRi killed renamable $r0, 0, 14 /* CC::al */, $noreg :: (load (s32) from %ir.next4)
149 ; CHECK-LOB-NEXT: tCBZ renamable $r0, %bb.9
150 ; CHECK-LOB-NEXT: t2LE %bb.3
151 ; CHECK-LOB-NEXT: {{ $}}
152 ; CHECK-LOB-NEXT: bb.5.while.cond9.preheader:
153 ; CHECK-LOB-NEXT: successors: %bb.9(0x30000000), %bb.6(0x50000000)
154 ; CHECK-LOB-NEXT: liveins: $r0, $r1
155 ; CHECK-LOB-NEXT: {{ $}}
156 ; CHECK-LOB-NEXT: tCBZ renamable $r0, %bb.9
157 ; CHECK-LOB-NEXT: {{ $}}
158 ; CHECK-LOB-NEXT: bb.6.land.rhs11.lr.ph:
159 ; CHECK-LOB-NEXT: successors: %bb.7(0x80000000)
160 ; CHECK-LOB-NEXT: liveins: $r0, $r1
161 ; CHECK-LOB-NEXT: {{ $}}
162 ; CHECK-LOB-NEXT: renamable $r1 = t2LDRSHi12 killed renamable $r1, 0, 14 /* CC::al */, $noreg :: (load (s16) from %ir.data16143)
163 ; CHECK-LOB-NEXT: {{ $}}
164 ; CHECK-LOB-NEXT: bb.7.land.rhs11:
165 ; CHECK-LOB-NEXT: successors: %bb.10(0x04000000), %bb.8(0x7c000000)
166 ; CHECK-LOB-NEXT: liveins: $r0, $r1
167 ; CHECK-LOB-NEXT: {{ $}}
168 ; CHECK-LOB-NEXT: renamable $r2 = tLDRi renamable $r0, 1, 14 /* CC::al */, $noreg :: (load (s32) from %ir.info12)
169 ; CHECK-LOB-NEXT: renamable $r2 = tLDRBi killed renamable $r2, 0, 14 /* CC::al */, $noreg :: (load (s8) from %ir.data165, align 2)
170 ; CHECK-LOB-NEXT: tCMPr killed renamable $r2, renamable $r1, 14 /* CC::al */, $noreg, implicit-def $cpsr
171 ; CHECK-LOB-NEXT: tBcc %bb.10, 0 /* CC::eq */, killed $cpsr
172 ; CHECK-LOB-NEXT: {{ $}}
173 ; CHECK-LOB-NEXT: bb.8.while.body19:
174 ; CHECK-LOB-NEXT: successors: %bb.9(0x04000000), %bb.7(0x7c000000)
175 ; CHECK-LOB-NEXT: liveins: $r0, $r1
176 ; CHECK-LOB-NEXT: {{ $}}
177 ; CHECK-LOB-NEXT: renamable $r0 = tLDRi killed renamable $r0, 0, 14 /* CC::al */, $noreg :: (load (s32) from %ir.next206)
178 ; CHECK-LOB-NEXT: tCBZ renamable $r0, %bb.9
179 ; CHECK-LOB-NEXT: t2LE %bb.7
180 ; CHECK-LOB-NEXT: {{ $}}
181 ; CHECK-LOB-NEXT: bb.9:
182 ; CHECK-LOB-NEXT: successors: %bb.10(0x80000000)
183 ; CHECK-LOB-NEXT: {{ $}}
184 ; CHECK-LOB-NEXT: renamable $r0, dead $cpsr = tMOVi8 0, 14 /* CC::al */, $noreg
185 ; CHECK-LOB-NEXT: {{ $}}
186 ; CHECK-LOB-NEXT: bb.10.return:
187 ; CHECK-LOB-NEXT: liveins: $r0
188 ; CHECK-LOB-NEXT: {{ $}}
189 ; CHECK-LOB-NEXT: tBX_RET 14 /* CC::al */, $noreg, implicit killed $r0
191 ; CHECK-NOLOB-LABEL: name: search
192 ; CHECK-NOLOB: bb.0.entry:
193 ; CHECK-NOLOB-NEXT: successors: %bb.1(0x50000000), %bb.5(0x30000000)
194 ; CHECK-NOLOB-NEXT: liveins: $r0, $r1
195 ; CHECK-NOLOB-NEXT: {{ $}}
196 ; CHECK-NOLOB-NEXT: renamable $r2 = t2LDRSHi12 renamable $r1, 2, 14 /* CC::al */, $noreg :: (load (s16) from %ir.idx)
197 ; CHECK-NOLOB-NEXT: t2CMPri renamable $r2, -1, 14 /* CC::al */, $noreg, implicit-def $cpsr
198 ; CHECK-NOLOB-NEXT: tBcc %bb.5, 13 /* CC::le */, killed $cpsr
199 ; CHECK-NOLOB-NEXT: {{ $}}
200 ; CHECK-NOLOB-NEXT: bb.1.while.cond.preheader:
201 ; CHECK-NOLOB-NEXT: successors: %bb.9(0x30000000), %bb.2(0x50000000)
202 ; CHECK-NOLOB-NEXT: liveins: $r0, $r2
203 ; CHECK-NOLOB-NEXT: {{ $}}
204 ; CHECK-NOLOB-NEXT: tCBZ renamable $r0, %bb.9
205 ; CHECK-NOLOB-NEXT: {{ $}}
206 ; CHECK-NOLOB-NEXT: bb.2.land.rhs.preheader:
207 ; CHECK-NOLOB-NEXT: successors: %bb.3(0x80000000)
208 ; CHECK-NOLOB-NEXT: liveins: $r0, $r2
209 ; CHECK-NOLOB-NEXT: {{ $}}
210 ; CHECK-NOLOB-NEXT: renamable $r1 = tUXTH killed renamable $r2, 14 /* CC::al */, $noreg
211 ; CHECK-NOLOB-NEXT: {{ $}}
212 ; CHECK-NOLOB-NEXT: bb.3.land.rhs:
213 ; CHECK-NOLOB-NEXT: successors: %bb.4(0x80000000)
214 ; CHECK-NOLOB-NEXT: liveins: $r0, $r1
215 ; CHECK-NOLOB-NEXT: {{ $}}
216 ; CHECK-NOLOB-NEXT: renamable $r2 = tLDRi renamable $r0, 1, 14 /* CC::al */, $noreg :: (load (s32) from %ir.info2)
217 ; CHECK-NOLOB-NEXT: renamable $r2 = tLDRHi killed renamable $r2, 1, 14 /* CC::al */, $noreg :: (load (s16) from %ir.idx3)
218 ; CHECK-NOLOB-NEXT: tCMPr killed renamable $r2, renamable $r1, 14 /* CC::al */, $noreg, implicit-def $cpsr
219 ; CHECK-NOLOB-NEXT: t2IT 0, 8, implicit-def $itstate
220 ; CHECK-NOLOB-NEXT: tBX_RET 0 /* CC::eq */, killed $cpsr, implicit $r0, implicit killed $itstate
221 ; CHECK-NOLOB-NEXT: {{ $}}
222 ; CHECK-NOLOB-NEXT: bb.4.while.body:
223 ; CHECK-NOLOB-NEXT: successors: %bb.9(0x04000000), %bb.3(0x7c000000)
224 ; CHECK-NOLOB-NEXT: liveins: $r0, $r1
225 ; CHECK-NOLOB-NEXT: {{ $}}
226 ; CHECK-NOLOB-NEXT: renamable $r0 = tLDRi killed renamable $r0, 0, 14 /* CC::al */, $noreg :: (load (s32) from %ir.next4)
227 ; CHECK-NOLOB-NEXT: tCMPi8 renamable $r0, 0, 14 /* CC::al */, $noreg, implicit-def $cpsr
228 ; CHECK-NOLOB-NEXT: tBcc %bb.3, 1 /* CC::ne */, killed $cpsr
229 ; CHECK-NOLOB-NEXT: tB %bb.9, 14 /* CC::al */, $noreg
230 ; CHECK-NOLOB-NEXT: {{ $}}
231 ; CHECK-NOLOB-NEXT: bb.5.while.cond9.preheader:
232 ; CHECK-NOLOB-NEXT: successors: %bb.9(0x30000000), %bb.6(0x50000000)
233 ; CHECK-NOLOB-NEXT: liveins: $r0, $r1
234 ; CHECK-NOLOB-NEXT: {{ $}}
235 ; CHECK-NOLOB-NEXT: tCBZ renamable $r0, %bb.9
236 ; CHECK-NOLOB-NEXT: {{ $}}
237 ; CHECK-NOLOB-NEXT: bb.6.land.rhs11.lr.ph:
238 ; CHECK-NOLOB-NEXT: successors: %bb.7(0x80000000)
239 ; CHECK-NOLOB-NEXT: liveins: $r0, $r1
240 ; CHECK-NOLOB-NEXT: {{ $}}
241 ; CHECK-NOLOB-NEXT: renamable $r1 = t2LDRSHi12 killed renamable $r1, 0, 14 /* CC::al */, $noreg :: (load (s16) from %ir.data16143)
242 ; CHECK-NOLOB-NEXT: {{ $}}
243 ; CHECK-NOLOB-NEXT: bb.7.land.rhs11:
244 ; CHECK-NOLOB-NEXT: successors: %bb.10(0x04000000), %bb.8(0x7c000000)
245 ; CHECK-NOLOB-NEXT: liveins: $r0, $r1
246 ; CHECK-NOLOB-NEXT: {{ $}}
247 ; CHECK-NOLOB-NEXT: renamable $r2 = tLDRi renamable $r0, 1, 14 /* CC::al */, $noreg :: (load (s32) from %ir.info12)
248 ; CHECK-NOLOB-NEXT: renamable $r2 = tLDRBi killed renamable $r2, 0, 14 /* CC::al */, $noreg :: (load (s8) from %ir.data165, align 2)
249 ; CHECK-NOLOB-NEXT: tCMPr killed renamable $r2, renamable $r1, 14 /* CC::al */, $noreg, implicit-def $cpsr
250 ; CHECK-NOLOB-NEXT: tBcc %bb.10, 0 /* CC::eq */, killed $cpsr
251 ; CHECK-NOLOB-NEXT: {{ $}}
252 ; CHECK-NOLOB-NEXT: bb.8.while.body19:
253 ; CHECK-NOLOB-NEXT: successors: %bb.9(0x04000000), %bb.7(0x7c000000)
254 ; CHECK-NOLOB-NEXT: liveins: $r0, $r1
255 ; CHECK-NOLOB-NEXT: {{ $}}
256 ; CHECK-NOLOB-NEXT: renamable $r0 = tLDRi killed renamable $r0, 0, 14 /* CC::al */, $noreg :: (load (s32) from %ir.next206)
257 ; CHECK-NOLOB-NEXT: tCMPi8 renamable $r0, 0, 14 /* CC::al */, $noreg, implicit-def $cpsr
258 ; CHECK-NOLOB-NEXT: tBcc %bb.7, 1 /* CC::ne */, killed $cpsr
259 ; CHECK-NOLOB-NEXT: {{ $}}
260 ; CHECK-NOLOB-NEXT: bb.9:
261 ; CHECK-NOLOB-NEXT: successors: %bb.10(0x80000000)
262 ; CHECK-NOLOB-NEXT: {{ $}}
263 ; CHECK-NOLOB-NEXT: renamable $r0, dead $cpsr = tMOVi8 0, 14 /* CC::al */, $noreg
264 ; CHECK-NOLOB-NEXT: {{ $}}
265 ; CHECK-NOLOB-NEXT: bb.10.return:
266 ; CHECK-NOLOB-NEXT: liveins: $r0
267 ; CHECK-NOLOB-NEXT: {{ $}}
268 ; CHECK-NOLOB-NEXT: tBX_RET 14 /* CC::al */, $noreg, implicit killed $r0
270 successors: %bb.5(0x50000000), %bb.1(0x30000000)
273 renamable $r2 = t2LDRSHi12 renamable $r1, 2, 14, $noreg :: (load (s16) from %ir.idx)
274 t2CMPri renamable $r2, -1, 14, $noreg, implicit-def $cpsr
275 t2Bcc %bb.1, 13, killed $cpsr
277 bb.5.while.cond.preheader:
278 successors: %bb.8(0x30000000), %bb.6(0x50000000)
281 tCMPi8 renamable $r0, 0, 14, $noreg, implicit-def $cpsr
282 t2Bcc %bb.8, 0, killed $cpsr
284 bb.6.land.rhs.preheader:
285 successors: %bb.7(0x80000000)
288 renamable $r1 = tUXTH killed renamable $r2, 14, $noreg
291 successors: %bb.10(0x80000000)
294 renamable $r2 = tLDRi renamable $r0, 1, 14, $noreg :: (load (s32) from %ir.info2)
295 renamable $r2 = tLDRHi killed renamable $r2, 1, 14, $noreg :: (load (s16) from %ir.idx3)
296 tCMPr killed renamable $r2, renamable $r1, 14, $noreg, implicit-def $cpsr
297 t2IT 0, 8, implicit-def $itstate
298 tBX_RET 0, killed $cpsr, implicit $r0, implicit killed $itstate
301 successors: %bb.8(0x04000000), %bb.7(0x7c000000)
304 renamable $r0 = tLDRi killed renamable $r0, 0, 14, $noreg :: (load (s32) from %ir.next4)
305 tCMPi8 renamable $r0, 0, 14, $noreg, implicit-def $cpsr
306 t2Bcc %bb.7, 1, killed $cpsr
307 t2B %bb.8, 14, $noreg
309 bb.1.while.cond9.preheader:
310 successors: %bb.8(0x30000000), %bb.2(0x50000000)
313 tCMPi8 renamable $r0, 0, 14, $noreg, implicit-def $cpsr
314 t2Bcc %bb.8, 0, killed $cpsr
316 bb.2.land.rhs11.lr.ph:
317 successors: %bb.3(0x80000000)
320 renamable $r1 = t2LDRSHi12 killed renamable $r1, 0, 14, $noreg :: (load (s16) from %ir.data16143)
323 successors: %bb.9(0x04000000), %bb.4(0x7c000000)
326 renamable $r2 = tLDRi renamable $r0, 1, 14, $noreg :: (load (s32) from %ir.info12)
327 renamable $r2 = tLDRBi killed renamable $r2, 0, 14, $noreg :: (load (s8) from %ir.data165, align 2)
328 tCMPr killed renamable $r2, renamable $r1, 14, $noreg, implicit-def $cpsr
329 t2Bcc %bb.9, 0, killed $cpsr
332 successors: %bb.8(0x04000000), %bb.3(0x7c000000)
335 renamable $r0 = tLDRi killed renamable $r0, 0, 14, $noreg :: (load (s32) from %ir.next206)
336 tCMPi8 renamable $r0, 0, 14, $noreg, implicit-def $cpsr
337 t2Bcc %bb.3, 1, killed $cpsr
340 successors: %bb.9(0x80000000)
342 renamable $r0, dead $cpsr = tMOVi8 0, 14, $noreg
347 tBX_RET 14, $noreg, implicit killed $r0