xref: /llvm-project/llvm/test/Analysis/LoopNestAnalysis/perfectnest.ll (revision 1aee1e1f4c4b504becc06521546de992a662694b)
1; RUN: opt < %s -passes='print<loopnest>' -disable-output 2>&1 | FileCheck %s
2
3; Test a perfect 2-dim loop nest of the form:
4;   for(i=0; i<nx; ++i)
5;     for(j=0; j<nx; ++j)
6;       y[i][j] = x[i][j];
7
8define void @perf_nest_2D_1(ptr %y, ptr %x, i64 signext %nx, i64 signext %ny) {
9; CHECK-LABEL: IsPerfect=true, Depth=1, OutermostLoop: perf_nest_2D_1_loop_j, Loops: ( perf_nest_2D_1_loop_j )
10; CHECK-LABEL: IsPerfect=true, Depth=2, OutermostLoop: perf_nest_2D_1_loop_i, Loops: ( perf_nest_2D_1_loop_i perf_nest_2D_1_loop_j )
11entry:
12  br label %perf_nest_2D_1_loop_i
13
14perf_nest_2D_1_loop_i:
15  %i = phi i64 [ 0, %entry ], [ %inc13, %inc_i ]
16  %cmp21 = icmp slt i64 0, %ny
17  br i1 %cmp21, label %perf_nest_2D_1_loop_j, label %inc_i
18
19perf_nest_2D_1_loop_j:
20  %j = phi i64 [ 0, %perf_nest_2D_1_loop_i ], [ %inc, %inc_j ]
21  %arrayidx = getelementptr inbounds ptr, ptr %x, i64 %j
22  %0 = load ptr, ptr %arrayidx, align 8
23  %arrayidx6 = getelementptr inbounds i32, ptr %0, i64 %j
24  %1 = load i32, ptr %arrayidx6, align 4
25  %arrayidx8 = getelementptr inbounds ptr, ptr %y, i64 %j
26  %2 = load ptr, ptr %arrayidx8, align 8
27  %arrayidx11 = getelementptr inbounds i32, ptr %2, i64 %i
28  store i32 %1, ptr %arrayidx11, align 4
29  br label %inc_j
30
31inc_j:
32  %inc = add nsw i64 %j, 1
33  %cmp2 = icmp slt i64 %inc, %ny
34  br i1 %cmp2, label %perf_nest_2D_1_loop_j, label %inc_i
35
36inc_i:
37  %inc13 = add nsw i64 %i, 1
38  %cmp = icmp slt i64 %inc13, %nx
39  br i1 %cmp, label %perf_nest_2D_1_loop_i, label %perf_nest_2D_1_loop_i_end
40
41perf_nest_2D_1_loop_i_end:
42  ret void
43}
44
45; Test a perfect 2-dim loop nest of the form:
46;   for (i=0; i<100; ++i)
47;     for (j=0; j<100; ++j)
48;       y[i][j] = x[i][j];
49define void @perf_nest_2D_2(ptr %y, ptr %x) {
50; CHECK-LABEL: IsPerfect=true, Depth=1, OutermostLoop: perf_nest_2D_2_loop_j, Loops: ( perf_nest_2D_2_loop_j )
51; CHECK-LABEL: IsPerfect=true, Depth=2, OutermostLoop: perf_nest_2D_2_loop_i, Loops: ( perf_nest_2D_2_loop_i perf_nest_2D_2_loop_j )
52entry:
53  br label %perf_nest_2D_2_loop_i
54
55perf_nest_2D_2_loop_i:
56  %i = phi i64 [ 0, %entry ], [ %inc13, %inc_i ]
57  br label %perf_nest_2D_2_loop_j
58
59perf_nest_2D_2_loop_j:
60  %j = phi i64 [ 0, %perf_nest_2D_2_loop_i ], [ %inc, %inc_j ]
61  %arrayidx = getelementptr inbounds ptr, ptr %x, i64 %j
62  %0 = load ptr, ptr %arrayidx, align 8
63  %arrayidx6 = getelementptr inbounds i32, ptr %0, i64 %j
64  %1 = load i32, ptr %arrayidx6, align 4
65  %arrayidx8 = getelementptr inbounds ptr, ptr %y, i64 %j
66  %2 = load ptr, ptr %arrayidx8, align 8
67  %arrayidx11 = getelementptr inbounds i32, ptr %2, i64 %i
68  store i32 %1, ptr %arrayidx11, align 4
69  br label %inc_j
70
71inc_j:
72  %inc = add nsw i64 %j, 1
73  %cmp2 = icmp slt i64 %inc, 100
74  br i1 %cmp2, label %perf_nest_2D_2_loop_j, label %loop_j_end
75
76loop_j_end:
77  br label %inc_i
78
79inc_i:
80  %inc13 = add nsw i64 %i, 1
81  %cmp = icmp slt i64 %inc13, 100
82  br i1 %cmp, label %perf_nest_2D_2_loop_i, label %perf_nest_2D_2_loop_i_end
83
84perf_nest_2D_2_loop_i_end:
85  ret void
86}
87
88define void @perf_nest_2D_3(ptr %y, ptr %x, i64 signext %nx, i64 signext %ny) {
89; CHECK-LABEL: IsPerfect=true, Depth=1, OutermostLoop: perf_nest_2D_3_loop_j, Loops: ( perf_nest_2D_3_loop_j )
90; CHECK-LABEL: IsPerfect=true, Depth=2, OutermostLoop: perf_nest_2D_3_loop_i, Loops: ( perf_nest_2D_3_loop_i perf_nest_2D_3_loop_j )
91entry:
92  br label %perf_nest_2D_3_loop_i
93
94perf_nest_2D_3_loop_i:
95  %i = phi i64 [ 0, %entry ], [ %inc13, %inc_i ]
96  %cmp21 = icmp slt i64 0, %ny
97  br label %singleSucc
98
99singleSucc:
100  br i1 %cmp21, label %preheader.j, label %for.end
101
102preheader.j:
103  br label %perf_nest_2D_3_loop_j
104
105perf_nest_2D_3_loop_j:
106  %j = phi i64 [ 0, %preheader.j ], [ %inc, %inc_j ]
107  %arrayidx = getelementptr inbounds ptr, ptr %x, i64 %j
108  %0 = load ptr, ptr %arrayidx, align 8
109  %arrayidx6 = getelementptr inbounds i32, ptr %0, i64 %j
110  %1 = load i32, ptr %arrayidx6, align 4
111  %arrayidx8 = getelementptr inbounds ptr, ptr %y, i64 %j
112  %2 = load ptr, ptr %arrayidx8, align 8
113  %arrayidx11 = getelementptr inbounds i32, ptr %2, i64 %i
114  store i32 %1, ptr %arrayidx11, align 4
115  br label %inc_j
116
117inc_j:
118  %inc = add nsw i64 %j, 1
119  %cmp2 = icmp slt i64 %inc, %ny
120  br i1 %cmp2, label %perf_nest_2D_3_loop_j, label %for.exit
121
122for.exit:
123  br label %for.end
124
125for.end:
126  br label %inc_i
127
128inc_i:
129  %inc13 = add nsw i64 %i, 1
130  %cmp = icmp slt i64 %inc13, %nx
131  br i1 %cmp, label %perf_nest_2D_3_loop_i, label %perf_nest_2D_3_loop_i_end
132
133perf_nest_2D_3_loop_i_end:
134  ret void
135}
136
137; Test a perfect 3-dim loop nest of the form:
138;   for (i=0; i<nx; ++i)
139;     for (j=0; j<ny; ++j)
140;       for (k=0; j<nk; ++k)
141;          y[j][j][k] = x[i][j][k];
142;
143
144define void @perf_nest_3D_1(ptr %y, ptr %x, i32 signext %nx, i32 signext %ny, i32 signext %nk) {
145; CHECK-LABEL: IsPerfect=true, Depth=1, OutermostLoop: perf_nest_3D_1_loop_k, Loops: ( perf_nest_3D_1_loop_k )
146; CHECK-NEXT: IsPerfect=true, Depth=2, OutermostLoop: perf_nest_3D_1_loop_j, Loops: ( perf_nest_3D_1_loop_j perf_nest_3D_1_loop_k )
147; CHECK-NEXT: IsPerfect=true, Depth=3, OutermostLoop: perf_nest_3D_1_loop_i, Loops: ( perf_nest_3D_1_loop_i perf_nest_3D_1_loop_j perf_nest_3D_1_loop_k )
148entry:
149  br label %perf_nest_3D_1_loop_i
150
151perf_nest_3D_1_loop_i:
152  %i = phi i32 [ 0, %entry ], [ %inci, %for.inci ]
153  %cmp21 = icmp slt i32 0, %ny
154  br i1 %cmp21, label %perf_nest_3D_1_loop_j, label %for.inci
155
156perf_nest_3D_1_loop_j:
157  %j = phi i32 [ 0, %perf_nest_3D_1_loop_i ], [ %incj, %for.incj ]
158  %cmp22 = icmp slt i32 0, %nk
159  br i1 %cmp22, label %perf_nest_3D_1_loop_k, label %for.incj
160
161perf_nest_3D_1_loop_k:
162  %k = phi i32 [ 0, %perf_nest_3D_1_loop_j ], [ %inck, %for.inck ]
163  %idxprom = sext i32 %i to i64
164  %arrayidx = getelementptr inbounds ptr, ptr %x, i64 %idxprom
165  %0 = load ptr, ptr %arrayidx, align 8
166  %idxprom7 = sext i32 %j to i64
167  %arrayidx8 = getelementptr inbounds ptr, ptr %0, i64 %idxprom7
168  %1 = load ptr, ptr %arrayidx8, align 8
169  %idxprom9 = sext i32 %k to i64
170  %arrayidx10 = getelementptr inbounds i32, ptr %1, i64 %idxprom9
171  %2 = load i32, ptr %arrayidx10, align 4
172  %idxprom11 = sext i32 %j to i64
173  %arrayidx12 = getelementptr inbounds ptr, ptr %y, i64 %idxprom11
174  %3 = load ptr, ptr %arrayidx12, align 8
175  %idxprom13 = sext i32 %j to i64
176  %arrayidx14 = getelementptr inbounds ptr, ptr %3, i64 %idxprom13
177  %4 = load ptr, ptr %arrayidx14, align 8
178  %idxprom15 = sext i32 %k to i64
179  %arrayidx16 = getelementptr inbounds i32, ptr %4, i64 %idxprom15
180  store i32 %2, ptr %arrayidx16, align 4
181  br label %for.inck
182
183for.inck:
184  %inck = add nsw i32 %k, 1
185  %cmp5 = icmp slt i32 %inck, %nk
186  br i1 %cmp5, label %perf_nest_3D_1_loop_k, label %for.incj
187
188for.incj:
189  %incj = add nsw i32 %j, 1
190  %cmp2 = icmp slt i32 %incj, %ny
191  br i1 %cmp2, label %perf_nest_3D_1_loop_j, label %for.inci
192
193for.inci:
194  %inci = add nsw i32 %i, 1
195  %cmp = icmp slt i32 %inci, %nx
196  br i1 %cmp, label %perf_nest_3D_1_loop_i, label %perf_nest_3D_1_loop_i_end
197
198perf_nest_3D_1_loop_i_end:
199  ret void
200}
201
202; Test a perfect 3-dim loop nest of the form:
203;   for (i=0; i<100; ++i)
204;     for (j=0; j<100; ++j)
205;       for (k=0; j<100; ++k)
206;          y[j][j][k] = x[i][j][k];
207;
208
209define void @perf_nest_3D_2(ptr %y, ptr %x) {
210; CHECK-LABEL: IsPerfect=true, Depth=1, OutermostLoop: perf_nest_3D_2_loop_k, Loops: ( perf_nest_3D_2_loop_k )
211; CHECK-NEXT: IsPerfect=true, Depth=2, OutermostLoop: perf_nest_3D_2_loop_j, Loops: ( perf_nest_3D_2_loop_j perf_nest_3D_2_loop_k )
212; CHECK-NEXT: IsPerfect=true, Depth=3, OutermostLoop: perf_nest_3D_2_loop_i, Loops: ( perf_nest_3D_2_loop_i perf_nest_3D_2_loop_j perf_nest_3D_2_loop_k )
213entry:
214  br label %perf_nest_3D_2_loop_i
215
216perf_nest_3D_2_loop_i:
217  %i = phi i32 [ 0, %entry ], [ %inci, %for.inci ]
218  br label %perf_nest_3D_2_loop_j
219
220perf_nest_3D_2_loop_j:
221  %j = phi i32 [ 0, %perf_nest_3D_2_loop_i ], [ %incj, %for.incj ]
222  br label %perf_nest_3D_2_loop_k
223
224perf_nest_3D_2_loop_k:
225  %k = phi i32 [ 0, %perf_nest_3D_2_loop_j ], [ %inck, %for.inck ]
226  %idxprom = sext i32 %i to i64
227  %arrayidx = getelementptr inbounds ptr, ptr %x, i64 %idxprom
228  %0 = load ptr, ptr %arrayidx, align 8
229  %idxprom7 = sext i32 %j to i64
230  %arrayidx8 = getelementptr inbounds ptr, ptr %0, i64 %idxprom7
231  %1 = load ptr, ptr %arrayidx8, align 8
232  %idxprom9 = sext i32 %k to i64
233  %arrayidx10 = getelementptr inbounds i32, ptr %1, i64 %idxprom9
234  %2 = load i32, ptr %arrayidx10, align 4
235  %idxprom11 = sext i32 %j to i64
236  %arrayidx12 = getelementptr inbounds ptr, ptr %y, i64 %idxprom11
237  %3 = load ptr, ptr %arrayidx12, align 8
238  %idxprom13 = sext i32 %j to i64
239  %arrayidx14 = getelementptr inbounds ptr, ptr %3, i64 %idxprom13
240  %4 = load ptr, ptr %arrayidx14, align 8
241  %idxprom15 = sext i32 %k to i64
242  %arrayidx16 = getelementptr inbounds i32, ptr %4, i64 %idxprom15
243  store i32 %2, ptr %arrayidx16, align 4
244  br label %for.inck
245
246for.inck:
247  %inck = add nsw i32 %k, 1
248  %cmp5 = icmp slt i32 %inck, 100
249  br i1 %cmp5, label %perf_nest_3D_2_loop_k, label %loop_k_end
250
251loop_k_end:
252  br label %for.incj
253
254for.incj:
255  %incj = add nsw i32 %j, 1
256  %cmp2 = icmp slt i32 %incj, 100
257  br i1 %cmp2, label %perf_nest_3D_2_loop_j, label %loop_j_end
258
259loop_j_end:
260  br label %for.inci
261
262for.inci:
263  %inci = add nsw i32 %i, 1
264  %cmp = icmp slt i32 %inci, 100
265  br i1 %cmp, label %perf_nest_3D_2_loop_i, label %perf_nest_3D_2_loop_i_end
266
267perf_nest_3D_2_loop_i_end:
268  ret void
269}
270
271; Test a perfect loop nest with a live out reduction:
272;   for (i = 0; i<ni; ++i)
273;     if (0<nj) { // guard branch for the j-loop
274;       for (j=0; j<nj; j+=1)
275;         x+=(i+j);
276;     }
277;   return x;
278
279define signext i32 @perf_nest_live_out(i32 signext %x, i32 signext %ni, i32 signext %nj) {
280; CHECK-LABEL: IsPerfect=true, Depth=1, OutermostLoop: perf_nest_live_out_loop_j, Loops: ( perf_nest_live_out_loop_j )
281; CHECK-LABEL: IsPerfect=true, Depth=2, OutermostLoop: perf_nest_live_out_loop_i, Loops: ( perf_nest_live_out_loop_i perf_nest_live_out_loop_j )
282entry:
283  %cmp4 = icmp slt i32 0, %ni
284  br i1 %cmp4, label %perf_nest_live_out_loop_i.lr.ph, label %for.end7
285
286perf_nest_live_out_loop_i.lr.ph:
287  br label %perf_nest_live_out_loop_i
288
289perf_nest_live_out_loop_i:
290  %x.addr.06 = phi i32 [ %x, %perf_nest_live_out_loop_i.lr.ph ], [ %x.addr.1.lcssa, %for.inc5 ]
291  %i.05 = phi i32 [ 0, %perf_nest_live_out_loop_i.lr.ph ], [ %inc6, %for.inc5 ]
292  %cmp21 = icmp slt i32 0, %nj
293  br i1 %cmp21, label %perf_nest_live_out_loop_j.lr.ph, label %for.inc5
294
295perf_nest_live_out_loop_j.lr.ph:
296  br label %perf_nest_live_out_loop_j
297
298perf_nest_live_out_loop_j:
299  %x.addr.13 = phi i32 [ %x.addr.06, %perf_nest_live_out_loop_j.lr.ph ], [ %add4, %perf_nest_live_out_loop_j ]
300  %j.02 = phi i32 [ 0, %perf_nest_live_out_loop_j.lr.ph ], [ %inc, %perf_nest_live_out_loop_j ]
301  %add = add nsw i32 %i.05, %j.02
302  %add4 = add nsw i32 %x.addr.13, %add
303  %inc = add nsw i32 %j.02, 1
304  %cmp2 = icmp slt i32 %inc, %nj
305  br i1 %cmp2, label %perf_nest_live_out_loop_j, label %for.cond1.for.inc5_crit_edge
306
307for.cond1.for.inc5_crit_edge:
308  %split = phi i32 [ %add4, %perf_nest_live_out_loop_j ]
309  br label %for.inc5
310
311for.inc5:
312  %x.addr.1.lcssa = phi i32 [ %split, %for.cond1.for.inc5_crit_edge ], [ %x.addr.06, %perf_nest_live_out_loop_i ]
313  %inc6 = add nsw i32 %i.05, 1
314  %cmp = icmp slt i32 %inc6, %ni
315  br i1 %cmp, label %perf_nest_live_out_loop_i, label %for.cond.for.end7_crit_edge
316
317for.cond.for.end7_crit_edge:
318  %split7 = phi i32 [ %x.addr.1.lcssa, %for.inc5 ]
319  br label %for.end7
320
321for.end7:
322  %x.addr.0.lcssa = phi i32 [ %split7, %for.cond.for.end7_crit_edge ], [ %x, %entry ]
323  ret i32 %x.addr.0.lcssa
324}
325
326; Test a perfect loop nest of the form:
327;   for (int i = 0; i < nx; ++i)
328;     if (i < ny) { // guard branch for the j-loop
329;       for (int j=i; j < ny; j+=1)
330;         y[j][i] = x[i][j] + j;
331;     }
332define double @perf_nest_guard_branch(ptr %y, ptr %x, i32 signext %nx, i32 signext %ny) {
333; CHECK-LABEL: IsPerfect=true, Depth=1, OutermostLoop: test6Loop2, Loops: ( test6Loop2 )
334; CHECK-LABEL: IsPerfect=true, Depth=2, OutermostLoop: test6Loop1, Loops: ( test6Loop1 test6Loop2 )
335entry:
336  %cmp2 = icmp slt i32 0, %nx
337  br i1 %cmp2, label %test6Loop1.lr.ph, label %for.end13
338
339test6Loop1.lr.ph:                                   ; preds = %entry
340  br label %test6Loop1
341
342test6Loop1:                                         ; preds = %test6Loop1.lr.ph, %for.inc11
343  %i.0 = phi i32 [ 0, %test6Loop1.lr.ph ], [ %inc12, %for.inc11 ]
344  %cmp1 = icmp slt i32 %i.0, %ny
345  br i1 %cmp1, label %test6Loop2.lr.ph, label %if.end
346
347test6Loop2.lr.ph:                                  ; preds = %if.then
348  br label %test6Loop2
349
350test6Loop2:                                        ; preds = %test6Loop2.lr.ph, %for.inc
351  %j.0 = phi i32 [ %i.0, %test6Loop2.lr.ph ], [ %inc, %for.inc ]
352  %idxprom = sext i32 %i.0 to i64
353  %arrayidx = getelementptr inbounds ptr, ptr %x, i64 %idxprom
354  %0 = load ptr, ptr %arrayidx, align 8
355  %idxprom5 = sext i32 %j.0 to i64
356  %arrayidx6 = getelementptr inbounds i32, ptr %0, i64 %idxprom5
357  %1 = load i32, ptr %arrayidx6, align 4
358  %add = add nsw i32 %1, %j.0
359  %idxprom7 = sext i32 %j.0 to i64
360  %arrayidx8 = getelementptr inbounds ptr, ptr %y, i64 %idxprom7
361  %2 = load ptr, ptr %arrayidx8, align 8
362  %idxprom9 = sext i32 %i.0 to i64
363  %arrayidx10 = getelementptr inbounds i32, ptr %2, i64 %idxprom9
364  store i32 %add, ptr %arrayidx10, align 4
365  br label %for.inc
366
367for.inc:                                          ; preds = %test6Loop2
368  %inc = add nsw i32 %j.0, 1
369  %cmp3 = icmp slt i32 %inc, %ny
370  br i1 %cmp3, label %test6Loop2, label %for.cond2.for.end_crit_edge
371
372for.cond2.for.end_crit_edge:                      ; preds = %for.inc
373  br label %for.end
374
375for.end:                                          ; preds = %for.cond2.for.end_crit_edge, %if.then
376  br label %if.end
377
378if.end:                                           ; preds = %for.end, %test6Loop1
379  br label %for.inc11
380
381for.inc11:                                        ; preds = %if.end
382  %inc12 = add nsw i32 %i.0, 1
383  %cmp = icmp slt i32 %inc12, %nx
384  br i1 %cmp, label %test6Loop1, label %for.cond.for.end13_crit_edge
385
386for.cond.for.end13_crit_edge:                     ; preds = %for.inc11
387  br label %for.end13
388
389for.end13:                                        ; preds = %for.cond.for.end13_crit_edge, %entry
390  %arrayidx14 = getelementptr inbounds ptr, ptr %y, i64 0
391  %3 = load ptr, ptr %arrayidx14, align 8
392  %arrayidx15 = getelementptr inbounds i32, ptr %3, i64 0
393  %4 = load i32, ptr %arrayidx15, align 4
394  %conv = sitofp i32 %4 to double
395  ret double %conv
396}
397
398; Test a perfect loop nest of the form:
399;   for (int i = 0; i < nx; ++i)
400;     if (i < ny) { // guard branch for the j-loop
401;       for (int j=i; j < ny; j+=1)
402;         y[j][i] = x[i][j] + j;
403;     }
404
405define double @test6(ptr %y, ptr %x, i32 signext %nx, i32 signext %ny) {
406; CHECK-LABEL: IsPerfect=true, Depth=1, OutermostLoop: test6Loop2, Loops: ( test6Loop2 )
407; CHECK-LABEL: IsPerfect=true, Depth=2, OutermostLoop: test6Loop1, Loops: ( test6Loop1 test6Loop2 )
408entry:
409  %cmp2 = icmp slt i32 0, %nx
410  br i1 %cmp2, label %test6Loop1.lr.ph, label %for.end13
411
412test6Loop1.lr.ph:                                   ; preds = %entry
413  br label %test6Loop1
414
415test6Loop1:                                         ; preds = %test6Loop1.lr.ph, %for.inc11
416  %i.0 = phi i32 [ 0, %test6Loop1.lr.ph ], [ %inc12, %for.inc11 ]
417  %cmp1 = icmp slt i32 %i.0, %ny
418  br i1 %cmp1, label %test6Loop2.lr.ph, label %if.end
419
420test6Loop2.lr.ph:                                  ; preds = %if.then
421  br label %test6Loop2
422
423test6Loop2:                                        ; preds = %test6Loop2.lr.ph, %for.inc
424  %j.0 = phi i32 [ %i.0, %test6Loop2.lr.ph ], [ %inc, %for.inc ]
425  %idxprom = sext i32 %i.0 to i64
426  %arrayidx = getelementptr inbounds ptr, ptr %x, i64 %idxprom
427  %0 = load ptr, ptr %arrayidx, align 8
428  %idxprom5 = sext i32 %j.0 to i64
429  %arrayidx6 = getelementptr inbounds i32, ptr %0, i64 %idxprom5
430  %1 = load i32, ptr %arrayidx6, align 4
431  %add = add nsw i32 %1, %j.0
432  %idxprom7 = sext i32 %j.0 to i64
433  %arrayidx8 = getelementptr inbounds ptr, ptr %y, i64 %idxprom7
434  %2 = load ptr, ptr %arrayidx8, align 8
435  %idxprom9 = sext i32 %i.0 to i64
436  %arrayidx10 = getelementptr inbounds i32, ptr %2, i64 %idxprom9
437  store i32 %add, ptr %arrayidx10, align 4
438  br label %for.inc
439
440for.inc:                                          ; preds = %test6Loop2
441  %inc = add nsw i32 %j.0, 1
442  %cmp3 = icmp slt i32 %inc, %ny
443  br i1 %cmp3, label %test6Loop2, label %for.cond2.for.end_crit_edge
444
445for.cond2.for.end_crit_edge:                      ; preds = %for.inc
446  br label %for.end
447
448for.end:                                          ; preds = %for.cond2.for.end_crit_edge, %if.then
449  br label %if.end
450
451if.end:                                           ; preds = %for.end, %test6Loop1
452  br label %for.inc11
453
454for.inc11:                                        ; preds = %if.end
455  %inc12 = add nsw i32 %i.0, 1
456  %cmp = icmp slt i32 %inc12, %nx
457  br i1 %cmp, label %test6Loop1, label %for.cond.for.end13_crit_edge
458
459for.cond.for.end13_crit_edge:                     ; preds = %for.inc11
460  br label %for.end13
461
462for.end13:                                        ; preds = %for.cond.for.end13_crit_edge, %entry
463  %arrayidx14 = getelementptr inbounds ptr, ptr %y, i64 0
464  %3 = load ptr, ptr %arrayidx14, align 8
465  %arrayidx15 = getelementptr inbounds i32, ptr %3, i64 0
466  %4 = load i32, ptr %arrayidx15, align 4
467  %conv = sitofp i32 %4 to double
468  ret double %conv
469}
470