1 # RUN: llc -mtriple=thumbv8.1m.main %s -run-pass=arm-cp-islands --verify-machineinstrs -o - | FileCheck %s
5 target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
6 target triple = "thumbv8.1m.main-unknown-unknown"
8 %struct.head_s = type { %struct.head_s*, %struct.data_s* }
9 %struct.data_s = type { i16, i16 }
11 ; Function Attrs: norecurse nounwind readonly
12 define dso_local arm_aapcscc %struct.head_s* @search(%struct.head_s* readonly %list, %struct.data_s* nocapture readonly %info) local_unnamed_addr #0 {
14 %idx = getelementptr inbounds %struct.data_s, %struct.data_s* %info, i32 0, i32 1
15 %tmp = load i16, i16* %idx, align 2
16 %cmp = icmp sgt i16 %tmp, -1
17 br i1 %cmp, label %while.cond.preheader, label %while.cond9.preheader
19 while.cond9.preheader: ; preds = %entry
20 %0 = icmp eq %struct.head_s* %list, null
21 br i1 %0, label %return, label %land.rhs11.lr.ph
23 land.rhs11.lr.ph: ; preds = %while.cond9.preheader
24 %data16143 = bitcast %struct.data_s* %info to i16*
25 %tmp1 = load i16, i16* %data16143, align 2
26 %conv15 = sext i16 %tmp1 to i32
29 while.cond.preheader: ; preds = %entry
30 %1 = icmp eq %struct.head_s* %list, null
31 br i1 %1, label %return, label %land.rhs.preheader
33 land.rhs.preheader: ; preds = %while.cond.preheader
36 while.body: ; preds = %land.rhs
37 %next4 = bitcast %struct.head_s* %list.addr.033 to %struct.head_s**
38 %tmp4 = load %struct.head_s*, %struct.head_s** %next4, align 4
39 %tobool = icmp eq %struct.head_s* %tmp4, null
40 br i1 %tobool, label %return, label %land.rhs
42 land.rhs: ; preds = %land.rhs.preheader, %while.body
43 %list.addr.033 = phi %struct.head_s* [ %tmp4, %while.body ], [ %list, %land.rhs.preheader ]
44 %info2 = getelementptr inbounds %struct.head_s, %struct.head_s* %list.addr.033, i32 0, i32 1
45 %tmp2 = load %struct.data_s*, %struct.data_s** %info2, align 4
46 %idx3 = getelementptr inbounds %struct.data_s, %struct.data_s* %tmp2, i32 0, i32 1
47 %tmp3 = load i16, i16* %idx3, align 2
48 %cmp7 = icmp eq i16 %tmp3, %tmp
49 br i1 %cmp7, label %return, label %while.body
51 while.body19: ; preds = %land.rhs11
52 %next205 = bitcast %struct.head_s* %list.addr.136 to %struct.head_s**
53 %tmp8 = load %struct.head_s*, %struct.head_s** %next205, align 4
54 %tobool10 = icmp eq %struct.head_s* %tmp8, null
55 br i1 %tobool10, label %return, label %land.rhs11
57 land.rhs11: ; preds = %while.body19, %land.rhs11.lr.ph
58 %list.addr.136 = phi %struct.head_s* [ %list, %land.rhs11.lr.ph ], [ %tmp8, %while.body19 ]
59 %info12 = getelementptr inbounds %struct.head_s, %struct.head_s* %list.addr.136, i32 0, i32 1
60 %tmp5 = load %struct.data_s*, %struct.data_s** %info12, align 4
61 %data166 = bitcast %struct.data_s* %tmp5 to i16*
62 %tmp6 = load i16, i16* %data166, align 2
63 %2 = and i16 %tmp6, 255
64 %and = zext i16 %2 to i32
65 %cmp16 = icmp eq i32 %and, %conv15
66 br i1 %cmp16, label %return, label %while.body19
68 return: ; preds = %land.rhs11, %while.body19, %land.rhs, %while.body, %while.cond.preheader, %while.cond9.preheader
69 %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 ]
70 ret %struct.head_s* %retval.0
73 attributes #0 = { norecurse nounwind readonly "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+armv8.1-m.main,+hwdiv,+lob,+ras,+soft-float,+strict-align,+thumb-mode,-crypto,-d32,-dotprod,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-neon,-vfp2,-vfp2d16,-vfp2d16sp,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" "unsafe-fp-math"="false" "use-soft-float"="true" }
79 exposesReturnsTwice: false
81 regBankSelected: false
84 tracksRegLiveness: true
88 - { reg: '$r0', virtual-reg: '' }
89 - { reg: '$r1', virtual-reg: '' }
91 isFrameAddressTaken: false
92 isReturnAddressTaken: false
102 cvBytesOfCalleeSavedRegisters: 0
103 hasOpaqueSPAdjustment: false
105 hasMustTailInVarArgFunc: false
113 machineFunctionInfo: {}
116 successors: %bb.3(0x50000000), %bb.1(0x30000000)
119 renamable $r2 = t2LDRSHi12 renamable $r1, 2, 14, $noreg :: (load 2 from %ir.idx)
120 t2CMPri renamable $r2, -1, 14, $noreg, implicit-def $cpsr
121 t2Bcc %bb.1, 13, killed $cpsr
123 bb.3.while.cond.preheader:
124 successors: %bb.4(0x80000000)
127 tCMPi8 renamable $r0, 0, 14, $noreg, implicit-def $cpsr
128 t2IT 0, 4, implicit-def $itstate
129 renamable $r0 = tMOVi8 $noreg, 0, 0, $cpsr, implicit killed $r0, implicit $itstate
130 tBX_RET 0, killed $cpsr, implicit $r0, implicit killed $itstate
131 renamable $r1 = tUXTH killed renamable $r2, 14, $noreg
134 successors: %bb.6(0x04000000), %bb.5(0x7c000000)
137 renamable $r2 = tLDRi renamable $r0, 1, 14, $noreg :: (load 4 from %ir.info2)
138 renamable $r2 = tLDRHi killed renamable $r2, 1, 14, $noreg :: (load 2 from %ir.idx3)
139 tCMPr killed renamable $r2, renamable $r1, 14, $noreg, implicit-def $cpsr
140 t2Bcc %bb.6, 0, killed $cpsr
143 successors: %bb.4(0x7c000000)
146 renamable $r0 = tLDRi killed renamable $r0, 0, 14, $noreg :: (load 4 from %ir.next4)
147 tCMPi8 renamable $r0, 0, 14, $noreg, implicit-def $cpsr
148 t2IT 0, 4, implicit-def $itstate
149 renamable $r0 = tMOVi8 $noreg, 0, 0, $cpsr, implicit killed $r0, implicit $itstate
150 tBX_RET 0, killed $cpsr, implicit $r0, implicit killed $itstate
151 t2B %bb.4, 14, $noreg
156 tBX_RET 14, $noreg, implicit $r0
158 bb.1.while.cond9.preheader:
159 successors: %bb.2(0x80000000)
162 tCMPi8 renamable $r0, 0, 14, $noreg, implicit-def $cpsr
163 t2IT 0, 4, implicit-def $itstate
164 renamable $r0 = tMOVi8 $noreg, 0, 0, $cpsr, implicit killed $r0, implicit $itstate
165 tBX_RET 0, killed $cpsr, implicit $r0, implicit killed $itstate
166 renamable $r1 = t2LDRSHi12 killed renamable $r1, 0, 14, $noreg :: (load 2 from %ir.data16143)
169 successors: %bb.2(0x7c000000)
172 renamable $r2 = tLDRi renamable $r0, 1, 14, $noreg :: (load 4 from %ir.info12)
173 renamable $r2 = tLDRBi killed renamable $r2, 0, 14, $noreg :: (load 1 from %ir.data166, align 2)
174 tCMPr killed renamable $r2, renamable $r1, 14, $noreg, implicit-def $cpsr
175 t2IT 0, 8, implicit-def $itstate
176 tBX_RET 0, killed $cpsr, implicit $r0, implicit killed $itstate
177 renamable $r0 = tLDRi killed renamable $r0, 0, 14, $noreg :: (load 4 from %ir.next205)
178 tCMPi8 renamable $r0, 0, 14, $noreg, implicit-def $cpsr
179 t2IT 0, 4, implicit-def $itstate
180 renamable $r0 = tMOVi8 $noreg, 0, 0, $cpsr, implicit killed $r0, implicit $itstate
181 tBX_RET 0, killed $cpsr, implicit $r0, implicit killed $itstate
182 t2B %bb.2, 14, $noreg