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