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 { %struct.head_s*, %struct.data_s* }
7 %struct.data_s = type { i16, i16 }
9 define dso_local arm_aapcscc %struct.head_s* @search(%struct.head_s* readonly %list, %struct.data_s* nocapture readonly %info) local_unnamed_addr {
11 %idx = getelementptr inbounds %struct.data_s, %struct.data_s* %info, i32 0, i32 1
12 %0 = load i16, i16* %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 %struct.head_s* %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 %struct.data_s* %info to i16*
22 %2 = load i16, i16* %data16143, align 2
23 %conv15 = sext i16 %2 to i32
26 while.cond.preheader: ; preds = %entry
27 %3 = icmp eq %struct.head_s* %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 %struct.head_s* [ %6, %while.body ], [ %list, %land.rhs.preheader ]
35 %info2 = getelementptr inbounds %struct.head_s, %struct.head_s* %list.addr.033, i32 0, i32 1
36 %4 = load %struct.data_s*, %struct.data_s** %info2, align 4
37 %idx3 = getelementptr inbounds %struct.data_s, %struct.data_s* %4, i32 0, i32 1
38 %5 = load i16, i16* %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 %struct.head_s* %list.addr.033 to %struct.head_s**
44 %6 = load %struct.head_s*, %struct.head_s** %next4, align 4
45 %tobool = icmp ne %struct.head_s* %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 %struct.head_s* [ %list, %land.rhs11.lr.ph ], [ %10, %while.body19 ]
50 %info12 = getelementptr inbounds %struct.head_s, %struct.head_s* %list.addr.136, i32 0, i32 1
51 %7 = load %struct.data_s*, %struct.data_s** %info12, align 4
52 %data165 = bitcast %struct.data_s* %7 to i16*
53 %8 = load i16, i16* %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 %struct.head_s* %list.addr.136 to %struct.head_s**
61 %10 = load %struct.head_s*, %struct.head_s** %next206, align 4
62 %tobool10 = icmp eq %struct.head_s* %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 %struct.head_s* [ null, %while.cond.preheader ], [ null, %while.cond9.preheader ], [ null, %while.body ], [ %list.addr.033, %land.rhs ], [ null, %while.body19 ], [ %list.addr.136, %land.rhs11 ]
67 ret %struct.head_s* %retval.0
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: successors: %bb.1(0x50000000), %bb.5(0x30000000)
113 ; CHECK-LOB: liveins: $r0, $r1
114 ; CHECK-LOB: renamable $r2 = t2LDRSHi12 renamable $r1, 2, 14 /* CC::al */, $noreg :: (load (s16) from %ir.idx)
115 ; CHECK-LOB: t2CMPri renamable $r2, -1, 14 /* CC::al */, $noreg, implicit-def $cpsr
116 ; CHECK-LOB: tBcc %bb.5, 13 /* CC::le */, killed $cpsr
117 ; CHECK-LOB: bb.1.while.cond.preheader:
118 ; CHECK-LOB: successors: %bb.9(0x30000000), %bb.2(0x50000000)
119 ; CHECK-LOB: liveins: $r0, $r2
120 ; CHECK-LOB: tCBZ renamable $r0, %bb.9
121 ; CHECK-LOB: bb.2.land.rhs.preheader:
122 ; CHECK-LOB: successors: %bb.3(0x80000000)
123 ; CHECK-LOB: liveins: $r0, $r2
124 ; CHECK-LOB: renamable $r1 = tUXTH killed renamable $r2, 14 /* CC::al */, $noreg
125 ; CHECK-LOB: bb.3.land.rhs:
126 ; CHECK-LOB: successors: %bb.4(0x80000000)
127 ; CHECK-LOB: liveins: $r0, $r1
128 ; CHECK-LOB: renamable $r2 = tLDRi renamable $r0, 1, 14 /* CC::al */, $noreg :: (load (s32) from %ir.info2)
129 ; CHECK-LOB: renamable $r2 = tLDRHi killed renamable $r2, 1, 14 /* CC::al */, $noreg :: (load (s16) from %ir.idx3)
130 ; CHECK-LOB: tCMPr killed renamable $r2, renamable $r1, 14 /* CC::al */, $noreg, implicit-def $cpsr
131 ; CHECK-LOB: t2IT 0, 8, implicit-def $itstate
132 ; CHECK-LOB: tBX_RET 0 /* CC::eq */, killed $cpsr, implicit $r0, implicit killed $itstate
133 ; CHECK-LOB: bb.4.while.body:
134 ; CHECK-LOB: successors: %bb.9(0x04000000), %bb.3(0x7c000000)
135 ; CHECK-LOB: liveins: $r0, $r1
136 ; CHECK-LOB: renamable $r0 = tLDRi killed renamable $r0, 0, 14 /* CC::al */, $noreg :: (load (s32) from %ir.next4)
137 ; CHECK-LOB: tCBNZ renamable $r0, %bb.9
138 ; CHECK-LOB: t2LE %bb.3
139 ; CHECK-LOB: bb.5.while.cond9.preheader:
140 ; CHECK-LOB: successors: %bb.9(0x30000000), %bb.6(0x50000000)
141 ; CHECK-LOB: liveins: $r0, $r1
142 ; CHECK-LOB: tCBZ renamable $r0, %bb.9
143 ; CHECK-LOB: bb.6.land.rhs11.lr.ph:
144 ; CHECK-LOB: successors: %bb.7(0x80000000)
145 ; CHECK-LOB: liveins: $r0, $r1
146 ; CHECK-LOB: renamable $r1 = t2LDRSHi12 killed renamable $r1, 0, 14 /* CC::al */, $noreg :: (load (s16) from %ir.data16143)
147 ; CHECK-LOB: bb.7.land.rhs11:
148 ; CHECK-LOB: successors: %bb.10(0x04000000), %bb.8(0x7c000000)
149 ; CHECK-LOB: liveins: $r0, $r1
150 ; CHECK-LOB: renamable $r2 = tLDRi renamable $r0, 1, 14 /* CC::al */, $noreg :: (load (s32) from %ir.info12)
151 ; CHECK-LOB: renamable $r2 = tLDRBi killed renamable $r2, 0, 14 /* CC::al */, $noreg :: (load (s8) from %ir.data165, align 2)
152 ; CHECK-LOB: tCMPr killed renamable $r2, renamable $r1, 14 /* CC::al */, $noreg, implicit-def $cpsr
153 ; CHECK-LOB: tBcc %bb.10, 0 /* CC::eq */, killed $cpsr
154 ; CHECK-LOB: bb.8.while.body19:
155 ; CHECK-LOB: successors: %bb.9(0x04000000), %bb.7(0x7c000000)
156 ; CHECK-LOB: liveins: $r0, $r1
157 ; CHECK-LOB: renamable $r0 = tLDRi killed renamable $r0, 0, 14 /* CC::al */, $noreg :: (load (s32) from %ir.next206)
158 ; CHECK-LOB: tCBZ renamable $r0, %bb.9
159 ; CHECK-LOB: t2LE %bb.7
161 ; CHECK-LOB: successors: %bb.10(0x80000000)
162 ; CHECK-LOB: renamable $r0, dead $cpsr = tMOVi8 0, 14 /* CC::al */, $noreg
163 ; CHECK-LOB: bb.10.return:
164 ; CHECK-LOB: liveins: $r0
165 ; CHECK-LOB: tBX_RET 14 /* CC::al */, $noreg, implicit killed $r0
166 ; CHECK-NOLOB-LABEL: name: search
167 ; CHECK-NOLOB: bb.0.entry:
168 ; CHECK-NOLOB: successors: %bb.1(0x50000000), %bb.5(0x30000000)
169 ; CHECK-NOLOB: liveins: $r0, $r1
170 ; CHECK-NOLOB: renamable $r2 = t2LDRSHi12 renamable $r1, 2, 14 /* CC::al */, $noreg :: (load (s16) from %ir.idx)
171 ; CHECK-NOLOB: t2CMPri renamable $r2, -1, 14 /* CC::al */, $noreg, implicit-def $cpsr
172 ; CHECK-NOLOB: tBcc %bb.5, 13 /* CC::le */, killed $cpsr
173 ; CHECK-NOLOB: bb.1.while.cond.preheader:
174 ; CHECK-NOLOB: successors: %bb.9(0x30000000), %bb.2(0x50000000)
175 ; CHECK-NOLOB: liveins: $r0, $r2
176 ; CHECK-NOLOB: tCBZ renamable $r0, %bb.9
177 ; CHECK-NOLOB: bb.2.land.rhs.preheader:
178 ; CHECK-NOLOB: successors: %bb.3(0x80000000)
179 ; CHECK-NOLOB: liveins: $r0, $r2
180 ; CHECK-NOLOB: renamable $r1 = tUXTH killed renamable $r2, 14 /* CC::al */, $noreg
181 ; CHECK-NOLOB: bb.3.land.rhs:
182 ; CHECK-NOLOB: successors: %bb.4(0x80000000)
183 ; CHECK-NOLOB: liveins: $r0, $r1
184 ; CHECK-NOLOB: renamable $r2 = tLDRi renamable $r0, 1, 14 /* CC::al */, $noreg :: (load (s32) from %ir.info2)
185 ; CHECK-NOLOB: renamable $r2 = tLDRHi killed renamable $r2, 1, 14 /* CC::al */, $noreg :: (load (s16) from %ir.idx3)
186 ; CHECK-NOLOB: tCMPr killed renamable $r2, renamable $r1, 14 /* CC::al */, $noreg, implicit-def $cpsr
187 ; CHECK-NOLOB: t2IT 0, 8, implicit-def $itstate
188 ; CHECK-NOLOB: tBX_RET 0 /* CC::eq */, killed $cpsr, implicit $r0, implicit killed $itstate
189 ; CHECK-NOLOB: bb.4.while.body:
190 ; CHECK-NOLOB: successors: %bb.9(0x04000000), %bb.3(0x7c000000)
191 ; CHECK-NOLOB: liveins: $r0, $r1
192 ; CHECK-NOLOB: renamable $r0 = tLDRi killed renamable $r0, 0, 14 /* CC::al */, $noreg :: (load (s32) from %ir.next4)
193 ; CHECK-NOLOB: tCMPi8 renamable $r0, 0, 14 /* CC::al */, $noreg, implicit-def $cpsr
194 ; CHECK-NOLOB: tBcc %bb.3, 0 /* CC::eq */, killed $cpsr
195 ; CHECK-NOLOB: tB %bb.9, 14 /* CC::al */, $noreg
196 ; CHECK-NOLOB: bb.5.while.cond9.preheader:
197 ; CHECK-NOLOB: successors: %bb.9(0x30000000), %bb.6(0x50000000)
198 ; CHECK-NOLOB: liveins: $r0, $r1
199 ; CHECK-NOLOB: tCBZ renamable $r0, %bb.9
200 ; CHECK-NOLOB: bb.6.land.rhs11.lr.ph:
201 ; CHECK-NOLOB: successors: %bb.7(0x80000000)
202 ; CHECK-NOLOB: liveins: $r0, $r1
203 ; CHECK-NOLOB: renamable $r1 = t2LDRSHi12 killed renamable $r1, 0, 14 /* CC::al */, $noreg :: (load (s16) from %ir.data16143)
204 ; CHECK-NOLOB: bb.7.land.rhs11:
205 ; CHECK-NOLOB: successors: %bb.10(0x04000000), %bb.8(0x7c000000)
206 ; CHECK-NOLOB: liveins: $r0, $r1
207 ; CHECK-NOLOB: renamable $r2 = tLDRi renamable $r0, 1, 14 /* CC::al */, $noreg :: (load (s32) from %ir.info12)
208 ; CHECK-NOLOB: renamable $r2 = tLDRBi killed renamable $r2, 0, 14 /* CC::al */, $noreg :: (load (s8) from %ir.data165, align 2)
209 ; CHECK-NOLOB: tCMPr killed renamable $r2, renamable $r1, 14 /* CC::al */, $noreg, implicit-def $cpsr
210 ; CHECK-NOLOB: tBcc %bb.10, 0 /* CC::eq */, killed $cpsr
211 ; CHECK-NOLOB: bb.8.while.body19:
212 ; CHECK-NOLOB: successors: %bb.9(0x04000000), %bb.7(0x7c000000)
213 ; CHECK-NOLOB: liveins: $r0, $r1
214 ; CHECK-NOLOB: renamable $r0 = tLDRi killed renamable $r0, 0, 14 /* CC::al */, $noreg :: (load (s32) from %ir.next206)
215 ; CHECK-NOLOB: tCMPi8 renamable $r0, 0, 14 /* CC::al */, $noreg, implicit-def $cpsr
216 ; CHECK-NOLOB: tBcc %bb.7, 1 /* CC::ne */, killed $cpsr
218 ; CHECK-NOLOB: successors: %bb.10(0x80000000)
219 ; CHECK-NOLOB: renamable $r0, dead $cpsr = tMOVi8 0, 14 /* CC::al */, $noreg
220 ; CHECK-NOLOB: bb.10.return:
221 ; CHECK-NOLOB: liveins: $r0
222 ; CHECK-NOLOB: tBX_RET 14 /* CC::al */, $noreg, implicit killed $r0
224 successors: %bb.5(0x50000000), %bb.1(0x30000000)
227 renamable $r2 = t2LDRSHi12 renamable $r1, 2, 14 /* CC::al */, $noreg :: (load (s16) from %ir.idx)
228 t2CMPri renamable $r2, -1, 14 /* CC::al */, $noreg, implicit-def $cpsr
229 t2Bcc %bb.1, 13 /* CC::le */, killed $cpsr
231 bb.5.while.cond.preheader:
232 successors: %bb.9(0x30000000), %bb.6(0x50000000)
235 tCMPi8 renamable $r0, 0, 14 /* CC::al */, $noreg, implicit-def $cpsr
236 t2Bcc %bb.9, 0 /* CC::eq */, killed $cpsr
238 bb.6.land.rhs.preheader:
239 successors: %bb.7(0x80000000)
242 renamable $r1 = tUXTH killed renamable $r2, 14 /* CC::al */, $noreg
245 successors: %bb.8(0x80000000)
248 renamable $r2 = tLDRi renamable $r0, 1, 14 /* CC::al */, $noreg :: (load (s32) from %ir.info2)
249 renamable $r2 = tLDRHi killed renamable $r2, 1, 14 /* CC::al */, $noreg :: (load (s16) from %ir.idx3)
250 tCMPr killed renamable $r2, renamable $r1, 14 /* CC::al */, $noreg, implicit-def $cpsr
251 t2IT 0, 8, implicit-def $itstate
252 tBX_RET 0 /* CC::eq */, killed $cpsr, implicit $r0, implicit killed $itstate
255 successors: %bb.9(0x04000000), %bb.7(0x7c000000)
258 renamable $r0 = tLDRi killed renamable $r0, 0, 14 /* CC::al */, $noreg :: (load (s32) from %ir.next4)
259 tCMPi8 renamable $r0, 0, 14 /* CC::al */, $noreg, implicit-def $cpsr
260 t2Bcc %bb.7, 0 /* CC::eq */, killed $cpsr
261 t2B %bb.9, 14 /* CC::al */, $noreg
263 bb.1.while.cond9.preheader:
264 successors: %bb.9(0x30000000), %bb.2(0x50000000)
267 tCMPi8 renamable $r0, 0, 14 /* CC::al */, $noreg, implicit-def $cpsr
268 t2Bcc %bb.9, 0 /* CC::eq */, killed $cpsr
270 bb.2.land.rhs11.lr.ph:
271 successors: %bb.3(0x80000000)
274 renamable $r1 = t2LDRSHi12 killed renamable $r1, 0, 14 /* CC::al */, $noreg :: (load (s16) from %ir.data16143)
277 successors: %bb.10(0x04000000), %bb.4(0x7c000000)
280 renamable $r2 = tLDRi renamable $r0, 1, 14 /* CC::al */, $noreg :: (load (s32) from %ir.info12)
281 renamable $r2 = tLDRBi killed renamable $r2, 0, 14 /* CC::al */, $noreg :: (load (s8) from %ir.data165, align 2)
282 tCMPr killed renamable $r2, renamable $r1, 14 /* CC::al */, $noreg, implicit-def $cpsr
283 t2Bcc %bb.10, 0 /* CC::eq */, killed $cpsr
286 successors: %bb.9(0x04000000), %bb.3(0x7c000000)
289 renamable $r0 = tLDRi killed renamable $r0, 0, 14 /* CC::al */, $noreg :: (load (s32) from %ir.next206)
290 tCMPi8 renamable $r0, 0, 14 /* CC::al */, $noreg, implicit-def $cpsr
291 t2Bcc %bb.3, 1 /* CC::ne */, killed $cpsr
294 successors: %bb.10(0x80000000)
296 renamable $r0, dead $cpsr = tMOVi8 0, 14 /* CC::al */, $noreg
301 tBX_RET 14 /* CC::al */, $noreg, implicit killed $r0