1; RUN: opt < %s -loop-reduce
2target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
3target triple = "aarch64-unknown-linux-gnu"
4
5@d = internal unnamed_addr global i32** null, align 8
6
7define dso_local i32 @main() local_unnamed_addr {
8entry:
9  %.pre.pre = load i32**, i32*** @d, align 8
10  br label %for.body9
11
12for.body9:                                        ; preds = %for.body9, %entry
13  %i = phi i32** [ %.pre.pre, %entry ], [ %incdec.ptr, %for.body9 ]
14  %incdec.ptr = getelementptr inbounds i32*, i32** %i, i64 -1
15  br i1 undef, label %for.body9, label %for.inc
16
17for.inc:                                          ; preds = %for.body9
18  br label %for.body9.118
19
20for.body9.1:                                      ; preds = %for.inc.547, %for.body9.1
21  %i1 = phi i32** [ %incdec.ptr.1, %for.body9.1 ], [ %incdec.ptr.542, %for.inc.547 ]
22  %incdec.ptr.1 = getelementptr inbounds i32*, i32** %i1, i64 -1
23  br i1 undef, label %for.body9.1, label %for.inc.1
24
25for.inc.1:                                        ; preds = %for.body9.1
26  br label %for.body9.1.1
27
28for.body9.2:                                      ; preds = %for.inc.1.5, %for.body9.2
29  %i2 = phi i32** [ %incdec.ptr.2, %for.body9.2 ], [ %incdec.ptr.1.5, %for.inc.1.5 ]
30  %incdec.ptr.2 = getelementptr inbounds i32*, i32** %i2, i64 -1
31  br i1 undef, label %for.body9.2, label %for.inc.2
32
33for.inc.2:                                        ; preds = %for.body9.2
34  br label %for.body9.2.1
35
36for.body9.3:                                      ; preds = %for.inc.2.5, %for.body9.3
37  %i3 = phi i32** [ %incdec.ptr.3, %for.body9.3 ], [ %incdec.ptr.2.5, %for.inc.2.5 ]
38  %incdec.ptr.3 = getelementptr inbounds i32*, i32** %i3, i64 -1
39  br i1 undef, label %for.body9.3, label %for.inc.3
40
41for.inc.3:                                        ; preds = %for.body9.3
42  br label %for.body9.3.1
43
44for.body9.4:                                      ; preds = %for.inc.3.5, %for.body9.4
45  %i4 = phi i32** [ %incdec.ptr.4, %for.body9.4 ], [ %incdec.ptr.3.5, %for.inc.3.5 ]
46  %incdec.ptr.4 = getelementptr inbounds i32*, i32** %i4, i64 -1
47  br i1 undef, label %for.body9.4, label %for.inc.4
48
49for.inc.4:                                        ; preds = %for.body9.4
50  br label %for.body9.4.1
51
52for.body9.5:                                      ; preds = %for.inc.4.5, %for.body9.5
53  %i5 = phi i32** [ %incdec.ptr.5, %for.body9.5 ], [ %incdec.ptr.4.5, %for.inc.4.5 ]
54  %incdec.ptr.5 = getelementptr inbounds i32*, i32** %i5, i64 -1
55  br i1 undef, label %for.body9.5, label %for.inc.5
56
57for.inc.5:                                        ; preds = %for.body9.5
58  br label %for.body9.5.1
59
60for.body9.5.1:                                    ; preds = %for.body9.5.1, %for.inc.5
61  %i6 = phi i32** [ %incdec.ptr.5.1, %for.body9.5.1 ], [ %incdec.ptr.5, %for.inc.5 ]
62  %incdec.ptr.5.1 = getelementptr inbounds i32*, i32** %i6, i64 -1
63  br i1 undef, label %for.body9.5.1, label %for.inc.5.1
64
65for.inc.5.1:                                      ; preds = %for.body9.5.1
66  br label %for.body9.5.2
67
68for.body9.5.2:                                    ; preds = %for.body9.5.2, %for.inc.5.1
69  %i7 = phi i32** [ %incdec.ptr.5.2, %for.body9.5.2 ], [ %incdec.ptr.5.1, %for.inc.5.1 ]
70  %incdec.ptr.5.2 = getelementptr inbounds i32*, i32** %i7, i64 -1
71  br i1 undef, label %for.body9.5.2, label %for.inc.5.2
72
73for.inc.5.2:                                      ; preds = %for.body9.5.2
74  br label %for.body9.5.3
75
76for.body9.5.3:                                    ; preds = %for.body9.5.3, %for.inc.5.2
77  %i8 = phi i32** [ %incdec.ptr.5.3, %for.body9.5.3 ], [ %incdec.ptr.5.2, %for.inc.5.2 ]
78  %incdec.ptr.5.3 = getelementptr inbounds i32*, i32** %i8, i64 -1
79  br i1 undef, label %for.body9.5.3, label %for.inc.5.3
80
81for.inc.5.3:                                      ; preds = %for.body9.5.3
82  br label %for.body9.5.4
83
84for.body9.5.4:                                    ; preds = %for.body9.5.4, %for.inc.5.3
85  %i9 = phi i32** [ %incdec.ptr.5.4, %for.body9.5.4 ], [ %incdec.ptr.5.3, %for.inc.5.3 ]
86  %incdec.ptr.5.4 = getelementptr inbounds i32*, i32** %i9, i64 -1
87  br i1 undef, label %for.body9.5.4, label %for.inc.5.4
88
89for.inc.5.4:                                      ; preds = %for.body9.5.4
90  br label %for.body9.5.5
91
92for.body9.5.5:                                    ; preds = %for.body9.5.5, %for.inc.5.4
93  %i10 = phi i32** [ undef, %for.body9.5.5 ], [ %incdec.ptr.5.4, %for.inc.5.4 ]
94  %i11 = bitcast i32** %i10 to i64*
95  %i12 = load i64, i64* %i11, align 8
96  br label %for.body9.5.5
97
98for.body9.4.1:                                    ; preds = %for.body9.4.1, %for.inc.4
99  %i13 = phi i32** [ %incdec.ptr.4.1, %for.body9.4.1 ], [ %incdec.ptr.4, %for.inc.4 ]
100  %incdec.ptr.4.1 = getelementptr inbounds i32*, i32** %i13, i64 -1
101  br i1 undef, label %for.body9.4.1, label %for.inc.4.1
102
103for.inc.4.1:                                      ; preds = %for.body9.4.1
104  br label %for.body9.4.2
105
106for.body9.4.2:                                    ; preds = %for.body9.4.2, %for.inc.4.1
107  %i14 = phi i32** [ %incdec.ptr.4.2, %for.body9.4.2 ], [ %incdec.ptr.4.1, %for.inc.4.1 ]
108  %incdec.ptr.4.2 = getelementptr inbounds i32*, i32** %i14, i64 -1
109  br i1 undef, label %for.body9.4.2, label %for.inc.4.2
110
111for.inc.4.2:                                      ; preds = %for.body9.4.2
112  br label %for.body9.4.3
113
114for.body9.4.3:                                    ; preds = %for.body9.4.3, %for.inc.4.2
115  %i15 = phi i32** [ %incdec.ptr.4.3, %for.body9.4.3 ], [ %incdec.ptr.4.2, %for.inc.4.2 ]
116  %incdec.ptr.4.3 = getelementptr inbounds i32*, i32** %i15, i64 -1
117  br i1 undef, label %for.body9.4.3, label %for.inc.4.3
118
119for.inc.4.3:                                      ; preds = %for.body9.4.3
120  br label %for.body9.4.4
121
122for.body9.4.4:                                    ; preds = %for.body9.4.4, %for.inc.4.3
123  %i16 = phi i32** [ %incdec.ptr.4.4, %for.body9.4.4 ], [ %incdec.ptr.4.3, %for.inc.4.3 ]
124  %incdec.ptr.4.4 = getelementptr inbounds i32*, i32** %i16, i64 -1
125  br i1 undef, label %for.body9.4.4, label %for.inc.4.4
126
127for.inc.4.4:                                      ; preds = %for.body9.4.4
128  br label %for.body9.4.5
129
130for.body9.4.5:                                    ; preds = %for.body9.4.5, %for.inc.4.4
131  %i17 = phi i32** [ %incdec.ptr.4.5, %for.body9.4.5 ], [ %incdec.ptr.4.4, %for.inc.4.4 ]
132  %incdec.ptr.4.5 = getelementptr inbounds i32*, i32** %i17, i64 -1
133  br i1 undef, label %for.body9.4.5, label %for.inc.4.5
134
135for.inc.4.5:                                      ; preds = %for.body9.4.5
136  br label %for.body9.5
137
138for.body9.3.1:                                    ; preds = %for.body9.3.1, %for.inc.3
139  %i18 = phi i32** [ %incdec.ptr.3.1, %for.body9.3.1 ], [ %incdec.ptr.3, %for.inc.3 ]
140  %incdec.ptr.3.1 = getelementptr inbounds i32*, i32** %i18, i64 -1
141  br i1 undef, label %for.body9.3.1, label %for.inc.3.1
142
143for.inc.3.1:                                      ; preds = %for.body9.3.1
144  br label %for.body9.3.2
145
146for.body9.3.2:                                    ; preds = %for.body9.3.2, %for.inc.3.1
147  %i19 = phi i32** [ %incdec.ptr.3.2, %for.body9.3.2 ], [ %incdec.ptr.3.1, %for.inc.3.1 ]
148  %incdec.ptr.3.2 = getelementptr inbounds i32*, i32** %i19, i64 -1
149  br i1 undef, label %for.body9.3.2, label %for.inc.3.2
150
151for.inc.3.2:                                      ; preds = %for.body9.3.2
152  br label %for.body9.3.3
153
154for.body9.3.3:                                    ; preds = %for.body9.3.3, %for.inc.3.2
155  %i20 = phi i32** [ %incdec.ptr.3.3, %for.body9.3.3 ], [ %incdec.ptr.3.2, %for.inc.3.2 ]
156  %incdec.ptr.3.3 = getelementptr inbounds i32*, i32** %i20, i64 -1
157  br i1 undef, label %for.body9.3.3, label %for.inc.3.3
158
159for.inc.3.3:                                      ; preds = %for.body9.3.3
160  br label %for.body9.3.4
161
162for.body9.3.4:                                    ; preds = %for.body9.3.4, %for.inc.3.3
163  %i21 = phi i32** [ %incdec.ptr.3.4, %for.body9.3.4 ], [ %incdec.ptr.3.3, %for.inc.3.3 ]
164  %incdec.ptr.3.4 = getelementptr inbounds i32*, i32** %i21, i64 -1
165  br i1 undef, label %for.body9.3.4, label %for.inc.3.4
166
167for.inc.3.4:                                      ; preds = %for.body9.3.4
168  br label %for.body9.3.5
169
170for.body9.3.5:                                    ; preds = %for.body9.3.5, %for.inc.3.4
171  %i22 = phi i32** [ %incdec.ptr.3.5, %for.body9.3.5 ], [ %incdec.ptr.3.4, %for.inc.3.4 ]
172  %incdec.ptr.3.5 = getelementptr inbounds i32*, i32** %i22, i64 -1
173  br i1 undef, label %for.body9.3.5, label %for.inc.3.5
174
175for.inc.3.5:                                      ; preds = %for.body9.3.5
176  br label %for.body9.4
177
178for.body9.2.1:                                    ; preds = %for.body9.2.1, %for.inc.2
179  %i23 = phi i32** [ %incdec.ptr.2.1, %for.body9.2.1 ], [ %incdec.ptr.2, %for.inc.2 ]
180  %incdec.ptr.2.1 = getelementptr inbounds i32*, i32** %i23, i64 -1
181  br i1 undef, label %for.body9.2.1, label %for.inc.2.1
182
183for.inc.2.1:                                      ; preds = %for.body9.2.1
184  br label %for.body9.2.2
185
186for.body9.2.2:                                    ; preds = %for.body9.2.2, %for.inc.2.1
187  %i24 = phi i32** [ %incdec.ptr.2.2, %for.body9.2.2 ], [ %incdec.ptr.2.1, %for.inc.2.1 ]
188  %incdec.ptr.2.2 = getelementptr inbounds i32*, i32** %i24, i64 -1
189  br i1 undef, label %for.body9.2.2, label %for.inc.2.2
190
191for.inc.2.2:                                      ; preds = %for.body9.2.2
192  br label %for.body9.2.3
193
194for.body9.2.3:                                    ; preds = %for.body9.2.3, %for.inc.2.2
195  %i25 = phi i32** [ %incdec.ptr.2.3, %for.body9.2.3 ], [ %incdec.ptr.2.2, %for.inc.2.2 ]
196  %incdec.ptr.2.3 = getelementptr inbounds i32*, i32** %i25, i64 -1
197  br i1 undef, label %for.body9.2.3, label %for.inc.2.3
198
199for.inc.2.3:                                      ; preds = %for.body9.2.3
200  br label %for.body9.2.4
201
202for.body9.2.4:                                    ; preds = %for.body9.2.4, %for.inc.2.3
203  %i26 = phi i32** [ %incdec.ptr.2.4, %for.body9.2.4 ], [ %incdec.ptr.2.3, %for.inc.2.3 ]
204  %incdec.ptr.2.4 = getelementptr inbounds i32*, i32** %i26, i64 -1
205  br i1 undef, label %for.body9.2.4, label %for.inc.2.4
206
207for.inc.2.4:                                      ; preds = %for.body9.2.4
208  br label %for.body9.2.5
209
210for.body9.2.5:                                    ; preds = %for.body9.2.5, %for.inc.2.4
211  %i27 = phi i32** [ %incdec.ptr.2.5, %for.body9.2.5 ], [ %incdec.ptr.2.4, %for.inc.2.4 ]
212  %incdec.ptr.2.5 = getelementptr inbounds i32*, i32** %i27, i64 -1
213  br i1 undef, label %for.body9.2.5, label %for.inc.2.5
214
215for.inc.2.5:                                      ; preds = %for.body9.2.5
216  br label %for.body9.3
217
218for.body9.1.1:                                    ; preds = %for.body9.1.1, %for.inc.1
219  %i28 = phi i32** [ %incdec.ptr.1.1, %for.body9.1.1 ], [ %incdec.ptr.1, %for.inc.1 ]
220  %incdec.ptr.1.1 = getelementptr inbounds i32*, i32** %i28, i64 -1
221  br i1 undef, label %for.body9.1.1, label %for.inc.1.1
222
223for.inc.1.1:                                      ; preds = %for.body9.1.1
224  br label %for.body9.1.2
225
226for.body9.1.2:                                    ; preds = %for.body9.1.2, %for.inc.1.1
227  %i29 = phi i32** [ %incdec.ptr.1.2, %for.body9.1.2 ], [ %incdec.ptr.1.1, %for.inc.1.1 ]
228  %incdec.ptr.1.2 = getelementptr inbounds i32*, i32** %i29, i64 -1
229  br i1 undef, label %for.body9.1.2, label %for.inc.1.2
230
231for.inc.1.2:                                      ; preds = %for.body9.1.2
232  br label %for.body9.1.3
233
234for.body9.1.3:                                    ; preds = %for.body9.1.3, %for.inc.1.2
235  %i30 = phi i32** [ %incdec.ptr.1.3, %for.body9.1.3 ], [ %incdec.ptr.1.2, %for.inc.1.2 ]
236  %incdec.ptr.1.3 = getelementptr inbounds i32*, i32** %i30, i64 -1
237  br i1 undef, label %for.body9.1.3, label %for.inc.1.3
238
239for.inc.1.3:                                      ; preds = %for.body9.1.3
240  br label %for.body9.1.4
241
242for.body9.1.4:                                    ; preds = %for.body9.1.4, %for.inc.1.3
243  %i31 = phi i32** [ %incdec.ptr.1.4, %for.body9.1.4 ], [ %incdec.ptr.1.3, %for.inc.1.3 ]
244  %incdec.ptr.1.4 = getelementptr inbounds i32*, i32** %i31, i64 -1
245  br i1 undef, label %for.body9.1.4, label %for.inc.1.4
246
247for.inc.1.4:                                      ; preds = %for.body9.1.4
248  br label %for.body9.1.5
249
250for.body9.1.5:                                    ; preds = %for.body9.1.5, %for.inc.1.4
251  %i32 = phi i32** [ %incdec.ptr.1.5, %for.body9.1.5 ], [ %incdec.ptr.1.4, %for.inc.1.4 ]
252  %incdec.ptr.1.5 = getelementptr inbounds i32*, i32** %i32, i64 -1
253  br i1 undef, label %for.body9.1.5, label %for.inc.1.5
254
255for.inc.1.5:                                      ; preds = %for.body9.1.5
256  br label %for.body9.2
257
258for.body9.118:                                    ; preds = %for.body9.118, %for.inc
259  %i33 = phi i32** [ %incdec.ptr, %for.inc ], [ %incdec.ptr.114, %for.body9.118 ]
260  %incdec.ptr.114 = getelementptr inbounds i32*, i32** %i33, i64 -1
261  br i1 undef, label %for.body9.118, label %for.inc.119
262
263for.inc.119:                                      ; preds = %for.body9.118
264  br label %for.body9.225
265
266for.body9.225:                                    ; preds = %for.body9.225, %for.inc.119
267  %i34 = phi i32** [ %incdec.ptr.114, %for.inc.119 ], [ %incdec.ptr.221, %for.body9.225 ]
268  %incdec.ptr.221 = getelementptr inbounds i32*, i32** %i34, i64 -1
269  %i35 = bitcast i32** %i34 to i64*
270  %i36 = load i64, i64* %i35, align 8
271  br i1 undef, label %for.body9.225, label %for.inc.226
272
273for.inc.226:                                      ; preds = %for.body9.225
274  br label %for.body9.332
275
276for.body9.332:                                    ; preds = %for.body9.332, %for.inc.226
277  %i37 = phi i32** [ %incdec.ptr.221, %for.inc.226 ], [ %incdec.ptr.328, %for.body9.332 ]
278  %incdec.ptr.328 = getelementptr inbounds i32*, i32** %i37, i64 -1
279  br i1 undef, label %for.body9.332, label %for.inc.333
280
281for.inc.333:                                      ; preds = %for.body9.332
282  br label %for.body9.439
283
284for.body9.439:                                    ; preds = %for.body9.439, %for.inc.333
285  %i38 = phi i32** [ %incdec.ptr.328, %for.inc.333 ], [ %incdec.ptr.435, %for.body9.439 ]
286  %incdec.ptr.435 = getelementptr inbounds i32*, i32** %i38, i64 -1
287  br i1 undef, label %for.body9.439, label %for.inc.440
288
289for.inc.440:                                      ; preds = %for.body9.439
290  br label %for.body9.546
291
292for.body9.546:                                    ; preds = %for.body9.546, %for.inc.440
293  %i39 = phi i32** [ %incdec.ptr.435, %for.inc.440 ], [ %incdec.ptr.542, %for.body9.546 ]
294  %incdec.ptr.542 = getelementptr inbounds i32*, i32** %i39, i64 -1
295  br i1 undef, label %for.body9.546, label %for.inc.547
296
297for.inc.547:                                      ; preds = %for.body9.546
298  br label %for.body9.1
299}
300