1; RUN: llc -march=hexagon -O3 -hexagon-small-data-threshold=0 < %s
2; REQUIRES: asserts
3
4target triple = "hexagon"
5
6%s.0 = type { %s.1, %s.1* }
7%s.1 = type { i8*, i8*, i8*, i32 }
8
9; Function Attrs: nounwind
10declare i32 @f0(%s.0* nocapture) #0 align 2
11
12; Function Attrs: nounwind
13declare void @f1(%s.0* nocapture) unnamed_addr #0 align 2
14
15; Function Attrs: inlinehint
16define void @f2(i32 %a0, i32 %a1, i32 %a2, i32 %a3, i32 %a4, %s.0* %a5, i1 (i8, i8)* %a6) #1 {
17b0:
18  %v0 = alloca %s.0, align 4
19  %v1 = alloca %s.0, align 4
20  %v2 = alloca %s.0, align 4
21  %v3 = alloca %s.0, align 4
22  %v4 = alloca %s.0, align 4
23  %v5 = alloca %s.0, align 4
24  %v6 = inttoptr i32 %a0 to i8*
25  %v7 = inttoptr i32 %a1 to i8*
26  %v8 = add nsw i32 %a4, %a3
27  %v9 = icmp eq i32 %v8, 2
28  br i1 %v9, label %b1, label %b2
29
30b1:                                               ; preds = %b0
31  call void @f7(i8* %v7, i8* %v6, i1 (i8, i8)* %a6)
32  br label %b43
33
34b2:                                               ; preds = %b0
35  %v10 = icmp sgt i32 %a3, %a4
36  br i1 %v10, label %b18, label %b3
37
38b3:                                               ; preds = %b2
39  %v11 = call i32 @f0(%s.0* %a5)
40  %v12 = icmp slt i32 %v11, %a3
41  br i1 %v12, label %b18, label %b4
42
43b4:                                               ; preds = %b3
44  %v13 = getelementptr inbounds %s.0, %s.0* %a5, i32 0, i32 1
45  %v14 = load %s.1*, %s.1** %v13, align 4, !tbaa !0
46  %v15 = getelementptr inbounds %s.1, %s.1* %v14, i32 0, i32 0
47  %v16 = load i8*, i8** %v15, align 4, !tbaa !0
48  %v17 = getelementptr inbounds %s.1, %s.1* %v14, i32 0, i32 1
49  store i8* %v16, i8** %v17, align 4, !tbaa !0
50  %v18 = bitcast %s.0* %v3 to i8*
51  call void @llvm.memset.p0i8.i64(i8* align 4 %v18, i8 0, i64 16, i1 false)
52  %v19 = load %s.1*, %s.1** %v13, align 4, !tbaa !0
53  %v20 = getelementptr inbounds %s.0, %s.0* %v3, i32 0, i32 1
54  store %s.1* %v19, %s.1** %v20, align 4, !tbaa !0
55  %v21 = bitcast %s.0* %v1 to i8*
56  call void @llvm.lifetime.start.p0i8(i64 -1, i8* %v21)
57  call void @llvm.memset.p0i8.i64(i8* align 4 %v21, i8 0, i64 16, i1 false)
58  %v22 = getelementptr inbounds %s.0, %s.0* %v1, i32 0, i32 1
59  store %s.1* %v19, %s.1** %v22, align 4, !tbaa !0
60  %v23 = icmp eq i8* %v6, %v7
61  br i1 %v23, label %b6, label %b5
62
63b5:                                               ; preds = %b4
64  call void @f8(i8* %v6, %s.0* %v1, i8* %v7)
65  %v24 = load %s.1*, %s.1** %v22, align 4, !tbaa !0
66  br label %b6
67
68b6:                                               ; preds = %b5, %b4
69  %v25 = phi %s.1* [ %v24, %b5 ], [ %v19, %b4 ]
70  %v26 = bitcast %s.0* %v2 to i8*
71  call void @llvm.memset.p0i8.i64(i8* align 4 %v26, i8 0, i64 16, i1 false)
72  %v27 = getelementptr inbounds %s.0, %s.0* %v2, i32 0, i32 1
73  store %s.1* %v25, %s.1** %v27, align 4, !tbaa !0
74  call void @f1(%s.0* %v1) #0
75  call void @llvm.lifetime.end.p0i8(i64 -1, i8* %v21)
76  call void @f1(%s.0* %v2) #0
77  call void @f1(%s.0* %v3) #0
78  %v28 = load %s.1*, %s.1** %v13, align 4, !tbaa !0
79  %v29 = getelementptr inbounds %s.1, %s.1* %v28, i32 0, i32 0
80  %v30 = load i8*, i8** %v29, align 4, !tbaa !0
81  %v31 = getelementptr inbounds %s.1, %s.1* %v28, i32 0, i32 1
82  %v32 = load i8*, i8** %v31, align 4, !tbaa !0
83  %v33 = inttoptr i32 %a2 to i8*
84  %v34 = icmp eq i8* %v30, %v32
85  br i1 %v34, label %b15, label %b7
86
87b7:                                               ; preds = %b6
88  br label %b8
89
90b8:                                               ; preds = %b12, %b7
91  %v35 = phi i8* [ %v47, %b12 ], [ %v30, %b7 ]
92  %v36 = phi i8* [ %v48, %b12 ], [ %v6, %b7 ]
93  %v37 = phi i8* [ %v46, %b12 ], [ %v7, %b7 ]
94  %v38 = icmp eq i8* %v37, %v33
95  br i1 %v38, label %b13, label %b9
96
97b9:                                               ; preds = %b8
98  %v39 = load i8, i8* %v37, align 1, !tbaa !4
99  %v40 = load i8, i8* %v35, align 1, !tbaa !4
100  %v41 = call zeroext i1 %a6(i8 zeroext %v39, i8 zeroext %v40)
101  br i1 %v41, label %b10, label %b11
102
103b10:                                              ; preds = %b9
104  %v42 = load i8, i8* %v37, align 1, !tbaa !4
105  store i8 %v42, i8* %v36, align 1, !tbaa !4
106  %v43 = getelementptr inbounds i8, i8* %v37, i32 1
107  br label %b12
108
109b11:                                              ; preds = %b9
110  %v44 = load i8, i8* %v35, align 1, !tbaa !4
111  store i8 %v44, i8* %v36, align 1, !tbaa !4
112  %v45 = getelementptr inbounds i8, i8* %v35, i32 1
113  br label %b12
114
115b12:                                              ; preds = %b11, %b10
116  %v46 = phi i8* [ %v43, %b10 ], [ %v37, %b11 ]
117  %v47 = phi i8* [ %v35, %b10 ], [ %v45, %b11 ]
118  %v48 = getelementptr inbounds i8, i8* %v36, i32 1
119  %v49 = icmp eq i8* %v47, %v32
120  br i1 %v49, label %b14, label %b8
121
122b13:                                              ; preds = %b8
123  call void @f9(i8* %v35, i8* %v36, i8* %v32)
124  br label %b43
125
126b14:                                              ; preds = %b12
127  br label %b15
128
129b15:                                              ; preds = %b14, %b6
130  %v50 = phi i8* [ %v7, %b6 ], [ %v46, %b14 ]
131  %v51 = phi i8* [ %v6, %b6 ], [ %v48, %b14 ]
132  %v52 = icmp eq i8* %v50, %v33
133  br i1 %v52, label %b43, label %b16
134
135b16:                                              ; preds = %b15
136  br label %b17
137
138b17:                                              ; preds = %b17, %b16
139  %v53 = phi i8* [ %v56, %b17 ], [ %v51, %b16 ]
140  %v54 = phi i8* [ %v57, %b17 ], [ %v50, %b16 ]
141  %v55 = load i8, i8* %v54, align 1, !tbaa !4
142  store i8 %v55, i8* %v53, align 1, !tbaa !4
143  %v56 = getelementptr inbounds i8, i8* %v53, i32 1
144  %v57 = getelementptr inbounds i8, i8* %v54, i32 1
145  %v58 = icmp eq i8* %v57, %v33
146  br i1 %v58, label %b42, label %b17
147
148b18:                                              ; preds = %b3, %b2
149  %v59 = call i32 @f0(%s.0* %a5)
150  %v60 = icmp slt i32 %v59, %a4
151  br i1 %v60, label %b33, label %b19
152
153b19:                                              ; preds = %b18
154  %v61 = getelementptr inbounds %s.0, %s.0* %a5, i32 0, i32 1
155  %v62 = load %s.1*, %s.1** %v61, align 4, !tbaa !0
156  %v63 = getelementptr inbounds %s.1, %s.1* %v62, i32 0, i32 0
157  %v64 = load i8*, i8** %v63, align 4, !tbaa !0
158  %v65 = getelementptr inbounds %s.1, %s.1* %v62, i32 0, i32 1
159  store i8* %v64, i8** %v65, align 4, !tbaa !0
160  %v66 = bitcast %s.0* %v5 to i8*
161  call void @llvm.memset.p0i8.i64(i8* align 4 %v66, i8 0, i64 16, i1 false)
162  %v67 = load %s.1*, %s.1** %v61, align 4, !tbaa !0
163  %v68 = getelementptr inbounds %s.0, %s.0* %v5, i32 0, i32 1
164  store %s.1* %v67, %s.1** %v68, align 4, !tbaa !0
165  %v69 = bitcast %s.0* %v0 to i8*
166  call void @llvm.lifetime.start.p0i8(i64 -1, i8* %v69)
167  call void @llvm.memset.p0i8.i64(i8* align 4 %v69, i8 0, i64 16, i1 false)
168  %v70 = getelementptr inbounds %s.0, %s.0* %v0, i32 0, i32 1
169  store %s.1* %v67, %s.1** %v70, align 4, !tbaa !0
170  %v71 = inttoptr i32 %a2 to i8*
171  %v72 = icmp eq i8* %v7, %v71
172  br i1 %v72, label %b21, label %b20
173
174b20:                                              ; preds = %b19
175  call void @f8(i8* %v7, %s.0* %v0, i8* %v71)
176  %v73 = load %s.1*, %s.1** %v70, align 4, !tbaa !0
177  br label %b21
178
179b21:                                              ; preds = %b20, %b19
180  %v74 = phi %s.1* [ %v73, %b20 ], [ %v67, %b19 ]
181  %v75 = bitcast %s.0* %v4 to i8*
182  call void @llvm.memset.p0i8.i64(i8* align 4 %v75, i8 0, i64 16, i1 false)
183  %v76 = getelementptr inbounds %s.0, %s.0* %v4, i32 0, i32 1
184  store %s.1* %v74, %s.1** %v76, align 4, !tbaa !0
185  call void @f1(%s.0* %v0) #0
186  call void @llvm.lifetime.end.p0i8(i64 -1, i8* %v69)
187  call void @f1(%s.0* %v4) #0
188  call void @f1(%s.0* %v5) #0
189  %v77 = load %s.1*, %s.1** %v61, align 4, !tbaa !0
190  %v78 = getelementptr inbounds %s.1, %s.1* %v77, i32 0, i32 0
191  %v79 = load i8*, i8** %v78, align 4, !tbaa !0
192  %v80 = getelementptr inbounds %s.1, %s.1* %v77, i32 0, i32 1
193  %v81 = load i8*, i8** %v80, align 4, !tbaa !0
194  %v82 = icmp eq i8* %v6, %v7
195  br i1 %v82, label %b25, label %b22
196
197b22:                                              ; preds = %b21
198  br label %b23
199
200b23:                                              ; preds = %b31, %b22
201  %v83 = phi i8* [ %v100, %b31 ], [ %v81, %b22 ]
202  %v84 = phi i8* [ %v111, %b31 ], [ %v71, %b22 ]
203  %v85 = phi i8* [ %v86, %b31 ], [ %v7, %b22 ]
204  %v86 = getelementptr inbounds i8, i8* %v85, i32 -1
205  %v87 = icmp eq i8* %v83, %v79
206  br i1 %v87, label %b28, label %b24
207
208b24:                                              ; preds = %b23
209  br label %b30
210
211b25:                                              ; preds = %b31, %b21
212  %v88 = phi i8* [ %v81, %b21 ], [ %v100, %b31 ]
213  %v89 = phi i8* [ %v71, %b21 ], [ %v111, %b31 ]
214  %v90 = icmp eq i8* %v88, %v79
215  br i1 %v90, label %b43, label %b26
216
217b26:                                              ; preds = %b25
218  br label %b27
219
220b27:                                              ; preds = %b27, %b26
221  %v91 = phi i8* [ %v93, %b27 ], [ %v88, %b26 ]
222  %v92 = phi i8* [ %v95, %b27 ], [ %v89, %b26 ]
223  %v93 = getelementptr inbounds i8, i8* %v91, i32 -1
224  %v94 = load i8, i8* %v93, align 1, !tbaa !4
225  %v95 = getelementptr inbounds i8, i8* %v92, i32 -1
226  store i8 %v94, i8* %v95, align 1, !tbaa !4
227  %v96 = icmp eq i8* %v93, %v79
228  br i1 %v96, label %b41, label %b27
229
230b28:                                              ; preds = %b31, %b23
231  %v97 = phi i8* [ %v111, %b31 ], [ %v84, %b23 ]
232  %v98 = icmp eq i8* %v6, %v85
233  br i1 %v98, label %b43, label %b29
234
235b29:                                              ; preds = %b28
236  call void @f6(i8* %v97, i8* %v85, i8* %v6)
237  br label %b43
238
239b30:                                              ; preds = %b31, %b24
240  %v99 = phi i8* [ %v111, %b31 ], [ %v84, %b24 ]
241  %v100 = phi i8* [ %v101, %b31 ], [ %v83, %b24 ]
242  %v101 = getelementptr inbounds i8, i8* %v100, i32 -1
243  %v102 = load i8, i8* %v101, align 1, !tbaa !4
244  %v103 = load i8, i8* %v86, align 1, !tbaa !4
245  %v104 = call zeroext i1 %a6(i8 zeroext %v102, i8 zeroext %v103)
246  br i1 %v104, label %b31, label %b32
247
248b31:                                              ; preds = %b32, %b30
249  %v105 = phi i8* [ %v101, %b32 ], [ %v86, %b30 ]
250  %v106 = phi i8* [ %v101, %b32 ], [ %v6, %b30 ]
251  %v107 = phi i8* [ %v79, %b32 ], [ %v86, %b30 ]
252  %v108 = phi i8* [ blockaddress(@f2, %b30), %b32 ], [ blockaddress(@f2, %b23), %b30 ]
253  %v109 = phi i8* [ blockaddress(@f2, %b28), %b32 ], [ blockaddress(@f2, %b25), %b30 ]
254  %v110 = load i8, i8* %v105, align 1, !tbaa !4
255  %v111 = getelementptr inbounds i8, i8* %v99, i32 -1
256  store i8 %v110, i8* %v111, align 1, !tbaa !4
257  %v112 = icmp eq i8* %v106, %v107
258  %v113 = select i1 %v112, i8* %v109, i8* %v108
259  indirectbr i8* %v113, [label %b25, label %b28, label %b23, label %b30]
260
261b32:                                              ; preds = %b30
262  br label %b31
263
264b33:                                              ; preds = %b18
265  br i1 %v10, label %b34, label %b37
266
267b34:                                              ; preds = %b33
268  %v114 = sdiv i32 %a3, 2
269  %v115 = getelementptr inbounds i8, i8* %v6, i32 %v114
270  %v116 = sub i32 %a2, %a1
271  %v117 = icmp sgt i32 %v116, 0
272  br i1 %v117, label %b35, label %b36
273
274b35:                                              ; preds = %b34
275  %v118 = call i8* @f5(i8* %v7, i32 %v116, i8* %v115, i1 (i8, i8)* %a6)
276  br label %b36
277
278b36:                                              ; preds = %b35, %b34
279  %v119 = phi i8* [ %v7, %b34 ], [ %v118, %b35 ]
280  %v120 = ptrtoint i8* %v119 to i32
281  %v121 = sub i32 %v120, %a1
282  br label %b40
283
284b37:                                              ; preds = %b33
285  %v122 = sdiv i32 %a4, 2
286  %v123 = getelementptr inbounds i8, i8* %v7, i32 %v122
287  %v124 = sub i32 %a1, %a0
288  %v125 = icmp sgt i32 %v124, 0
289  br i1 %v125, label %b38, label %b39
290
291b38:                                              ; preds = %b37
292  %v126 = call i8* @f4(i8* %v6, i32 %v124, i8* %v123, i1 (i8, i8)* %a6)
293  br label %b39
294
295b39:                                              ; preds = %b38, %b37
296  %v127 = phi i8* [ %v6, %b37 ], [ %v126, %b38 ]
297  %v128 = ptrtoint i8* %v127 to i32
298  %v129 = sub i32 %v128, %a0
299  br label %b40
300
301b40:                                              ; preds = %b39, %b36
302  %v130 = phi i8* [ %v127, %b39 ], [ %v115, %b36 ]
303  %v131 = phi i8* [ %v123, %b39 ], [ %v119, %b36 ]
304  %v132 = phi i32 [ %v129, %b39 ], [ %v114, %b36 ]
305  %v133 = phi i32 [ %v122, %b39 ], [ %v121, %b36 ]
306  %v134 = sub nsw i32 %a3, %v132
307  %v135 = ptrtoint i8* %v130 to i32
308  %v136 = ptrtoint i8* %v131 to i32
309  %v137 = call i32 @f3(i32 %v135, i32 %a1, i32 %v136, i32 %v134, i32 %v133, %s.0* %a5)
310  call void @f2(i32 %a0, i32 %v135, i32 %v137, i32 %v132, i32 %v133, %s.0* %a5, i1 (i8, i8)* %a6)
311  %v138 = sub nsw i32 %a4, %v133
312  call void @f2(i32 %v137, i32 %v136, i32 %a2, i32 %v134, i32 %v138, %s.0* %a5, i1 (i8, i8)* %a6)
313  br label %b43
314
315b41:                                              ; preds = %b27
316  br label %b43
317
318b42:                                              ; preds = %b17
319  br label %b43
320
321b43:                                              ; preds = %b42, %b41, %b40, %b29, %b28, %b25, %b15, %b13, %b1
322  ret void
323}
324
325; Function Attrs: inlinehint
326declare i32 @f3(i32, i32, i32, i32, i32, %s.0* nocapture) #1
327
328; Function Attrs: inlinehint
329declare i8* @f4(i8*, i32, i8*, i1 (i8, i8)*) #1
330
331; Function Attrs: inlinehint
332declare i8* @f5(i8*, i32, i8*, i1 (i8, i8)*) #1
333
334; Function Attrs: inlinehint
335declare void @f6(i8*, i8*, i8*) #1
336
337; Function Attrs: inlinehint
338declare void @f7(i8*, i8*, i1 (i8, i8)*) #1
339
340; Function Attrs: inlinehint
341declare void @f8(i8*, %s.0*, i8*) #1
342
343; Function Attrs: inlinehint
344declare void @f9(i8*, i8*, i8*) #1
345
346; Function Attrs: argmemonly nounwind
347declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #2
348
349; Function Attrs: argmemonly nounwind
350declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #2
351
352; Function Attrs: argmemonly nounwind
353declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1) #2
354
355attributes #0 = { nounwind }
356attributes #1 = { inlinehint }
357attributes #2 = { argmemonly nounwind }
358
359!0 = !{!1, !1, i64 0}
360!1 = !{!"any pointer", !2}
361!2 = !{!"omnipotent char", !3}
362!3 = !{!"Simple C/C++ TBAA"}
363!4 = !{!2, !2, i64 0}
364