1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=indvars -S | FileCheck %s
4 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
5 target triple = "x86_64-unknown-linux-gnu"
7 ; Function Attrs: nofree norecurse nounwind uwtable
8 define void @test(ptr nocapture readnone %arg, ptr noalias nocapture readnone %arg1, ptr noalias nocapture readnone %arg2, ptr noalias nocapture readonly %arg3, ptr noalias nocapture readnone %arg4) local_unnamed_addr #0 {
11 %tmp5 = load ptr, ptr %arg3, align 8, !invariant.load !0, !dereferenceable !1, !align !2
12 %tmp6 = getelementptr inbounds ptr, ptr %arg3, i64 3
13 %tmp7 = load ptr, ptr %tmp6, align 8, !invariant.load !0, !dereferenceable !3, !align !2
16 bb9: ; preds = %bb33, %bb
17 %tmp10 = phi i64 [ 0, %bb ], [ %tmp34, %bb33 ]
18 %tmp11 = sub nsw i64 9, %tmp10
21 bb12: ; preds = %bb30, %bb9
22 %tmp13 = phi i64 [ 0, %bb9 ], [ %tmp31, %bb30 ]
23 %tmp14 = sub nsw i64 4, %tmp13
26 bb15: ; preds = %bb27, %bb12
27 %tmp16 = phi i64 [ 0, %bb12 ], [ %tmp28, %bb27 ]
28 %tmp17 = mul i64 %tmp16, -2
29 %tmp18 = add i64 %tmp17, 2
32 bb19: ; preds = %bb19, %bb15
33 %tmp20 = phi i64 [ 0, %bb15 ], [ %tmp25, %bb19 ]
34 %tmp21 = add nuw nsw i64 %tmp18, %tmp20
35 %tmp22 = getelementptr inbounds [1 x [4 x [10 x [5 x float]]]], ptr %tmp5, i64 0, i64 0, i64 %tmp21, i64 %tmp11, i64 %tmp14
36 %tmp23 = load float, ptr %tmp22, align 4, !invariant.load !0, !noalias !4
37 %tmp24 = getelementptr inbounds [10 x [5 x [2 x [1 x [2 x float]]]]], ptr %tmp7, i64 0, i64 %tmp10, i64 %tmp13, i64 %tmp16, i64 0, i64 %tmp20
38 store float %tmp23, ptr %tmp24, align 4, !alias.scope !4, !noalias !7
39 %tmp25 = add nuw nsw i64 %tmp20, 1
40 %tmp26 = icmp eq i64 %tmp20, 0
41 br i1 %tmp26, label %bb19, label %bb27
44 %tmp28 = add nuw nsw i64 %tmp16, 1
45 %tmp29 = icmp eq i64 %tmp16, 0
46 br i1 %tmp29, label %bb15, label %bb30
49 %tmp31 = add nuw nsw i64 %tmp13, 1
50 %tmp32 = icmp ugt i64 %tmp13, 3
51 br i1 %tmp32, label %bb33, label %bb12
54 %tmp34 = add nuw nsw i64 %tmp10, 1
55 %tmp35 = icmp ugt i64 %tmp10, 8
56 br i1 %tmp35, label %bb36, label %bb9
59 %tmp37 = getelementptr inbounds ptr, ptr %arg3, i64 1
60 %tmp39 = load ptr, ptr %tmp37, align 8, !invariant.load !0, !dereferenceable !10, !align !2
61 %tmp40 = getelementptr inbounds i8, ptr %tmp7, i64 800
64 bb42: ; preds = %bb63, %bb36
65 %tmp43 = phi i64 [ 0, %bb36 ], [ %tmp64, %bb63 ]
68 bb44: ; preds = %bb60, %bb42
69 %tmp45 = phi i64 [ 0, %bb42 ], [ %tmp61, %bb60 ]
72 bb46: ; preds = %bb57, %bb44
73 %tmp47 = phi i64 [ 0, %bb44 ], [ %tmp58, %bb57 ]
76 bb48: ; preds = %bb48, %bb46
77 %tmp49 = phi i64 [ 0, %bb46 ], [ %tmp55, %bb48 ]
78 %tmp50 = shl nuw nsw i64 %tmp49, 1
79 %tmp51 = add nuw nsw i64 %tmp50, %tmp43
80 %tmp52 = getelementptr inbounds [1 x [4 x [6 x [7 x float]]]], ptr %tmp39, i64 0, i64 0, i64 %tmp51, i64 %tmp45, i64 %tmp47
81 %tmp53 = load float, ptr %tmp52, align 4, !invariant.load !0, !noalias !11
82 %tmp54 = getelementptr inbounds [2 x [6 x [7 x [2 x [1 x float]]]]], ptr %tmp40, i64 0, i64 %tmp43, i64 %tmp45, i64 %tmp47, i64 %tmp49, i64 0
83 store float %tmp53, ptr %tmp54, align 4, !alias.scope !11, !noalias !12
84 %tmp55 = add nuw nsw i64 %tmp49, 1
85 %tmp56 = icmp eq i64 %tmp49, 0
86 br i1 %tmp56, label %bb48, label %bb57
89 %tmp58 = add nuw nsw i64 %tmp47, 1
90 %tmp59 = icmp ugt i64 %tmp47, 5
91 br i1 %tmp59, label %bb60, label %bb46
94 %tmp61 = add nuw nsw i64 %tmp45, 1
95 %tmp62 = icmp ugt i64 %tmp45, 4
96 br i1 %tmp62, label %bb63, label %bb44
99 %tmp64 = add nuw nsw i64 %tmp43, 1
100 %tmp65 = icmp eq i64 %tmp43, 0
101 br i1 %tmp65, label %bb42, label %bb66
103 bb66: ; preds = %bb63
104 %tmp67 = getelementptr inbounds i8, ptr %tmp7, i64 1472
107 bb69: ; preds = %bb140, %bb66
108 %tmp70 = phi i64 [ 0, %bb66 ], [ %tmp141, %bb140 ]
111 bb71: ; preds = %bb137, %bb69
112 %tmp72 = phi i64 [ 0, %bb69 ], [ %tmp138, %bb137 ]
113 %tmp73 = shl nuw nsw i64 %tmp72, 1
114 %tmp74 = add nsw i64 %tmp73, -2
117 bb75: ; preds = %bb134, %bb71
118 %tmp76 = phi i64 [ 0, %bb71 ], [ %tmp135, %bb134 ]
119 %tmp77 = add nsw i64 %tmp76, -1
122 bb78: ; preds = %bb129, %bb75
123 %tmp79 = phi i64 [ 0, %bb75 ], [ %tmp132, %bb129 ]
126 bb80: ; preds = %bb125, %bb78
127 %tmp81 = phi float [ 0.000000e+00, %bb78 ], [ %tmp126, %bb125 ]
128 %tmp82 = phi i64 [ 0, %bb78 ], [ %tmp127, %bb125 ]
129 %tmp83 = shl nuw nsw i64 %tmp82, 1
130 %tmp84 = add nsw i64 %tmp83, -1
131 %tmp85 = icmp ult i64 %tmp84, 10
132 %tmp86 = sub nsw i64 5, %tmp82
133 br i1 %tmp85, label %bb88, label %bb87
135 bb87: ; preds = %bb80
138 bb88: ; preds = %bb80
141 bb89: ; preds = %bb100, %bb88
142 %tmp90 = phi float [ %tmp101, %bb100 ], [ %tmp81, %bb88 ]
143 %tmp91 = phi i64 [ %tmp102, %bb100 ], [ 0, %bb88 ]
144 %tmp92 = add i64 %tmp74, %tmp91
145 %tmp93 = icmp ult i64 %tmp92, 5
146 %tmp94 = sub nsw i64 6, %tmp91
147 br i1 %tmp93, label %bb96, label %bb95
149 bb95: ; preds = %bb89
152 bb96: ; preds = %bb89
155 bb97: ; preds = %bb110
156 %tmp98 = phi float [ %tmp111, %bb110 ]
159 bb99: ; preds = %bb95
162 bb100: ; preds = %bb99, %bb97
163 %tmp101 = phi float [ %tmp98, %bb97 ], [ %tmp90, %bb99 ]
164 %tmp102 = add nuw nsw i64 %tmp91, 1
165 %tmp103 = icmp ugt i64 %tmp91, 5
166 br i1 %tmp103, label %bb122, label %bb89
168 bb104: ; preds = %bb110, %bb96
169 %tmp105 = phi float [ %tmp111, %bb110 ], [ %tmp90, %bb96 ]
170 %tmp106 = phi i64 [ %tmp112, %bb110 ], [ 0, %bb96 ]
171 %tmp107 = shl nuw nsw i64 %tmp106, 1
172 ; CHECK-NOT: %bugged = add nuw nsw
173 ; CHECK: %bugged = add nsw
174 %bugged = add i64 %tmp77, %tmp107
175 %tmp109 = icmp ult i64 %bugged, 2
176 br i1 %tmp109, label %bb114, label %bb110
178 bb110: ; preds = %bb114, %bb104
179 %tmp111 = phi float [ %tmp121, %bb114 ], [ %tmp105, %bb104 ]
180 %tmp112 = add nuw nsw i64 %tmp106, 1
181 %tmp113 = icmp eq i64 %tmp106, 0
182 br i1 %tmp113, label %bb104, label %bb97
184 bb114: ; preds = %bb104
185 %tmp115 = sub nsw i64 1, %tmp106
186 %tmp116 = getelementptr inbounds [2 x [6 x [7 x [2 x [1 x float]]]]], ptr %tmp40, i64 0, i64 %tmp70, i64 %tmp86, i64 %tmp94, i64 %tmp115, i64 0
187 %tmp117 = getelementptr inbounds [10 x [5 x [2 x [1 x [2 x float]]]]], ptr %tmp7, i64 0, i64 %tmp84, i64 %tmp92, i64 %bugged, i64 0, i64 %tmp79
188 %tmp118 = load float, ptr %tmp117, align 4, !alias.scope !4, !noalias !7
189 %tmp119 = load float, ptr %tmp116, align 4, !alias.scope !11, !noalias !12
190 %tmp120 = fmul reassoc nsz contract float %tmp118, %tmp119
191 %tmp121 = fadd reassoc nsz contract float %tmp105, %tmp120
194 bb122: ; preds = %bb100
195 %tmp123 = phi float [ %tmp101, %bb100 ]
198 bb124: ; preds = %bb87
201 bb125: ; preds = %bb124, %bb122
202 %tmp126 = phi float [ %tmp123, %bb122 ], [ %tmp81, %bb124 ]
203 %tmp127 = add nuw nsw i64 %tmp82, 1
204 %tmp128 = icmp ugt i64 %tmp82, 4
205 br i1 %tmp128, label %bb129, label %bb80
207 bb129: ; preds = %bb125
208 %tmp130 = phi float [ %tmp126, %bb125 ]
209 %tmp131 = getelementptr inbounds [2 x [1 x [2 x [2 x [2 x float]]]]], ptr %tmp67, i64 0, i64 %tmp70, i64 0, i64 %tmp72, i64 %tmp76, i64 %tmp79
210 store float %tmp130, ptr %tmp131, align 4, !alias.scope !13, !noalias !14
211 %tmp132 = add nuw nsw i64 %tmp79, 1
212 %tmp133 = icmp eq i64 %tmp79, 0
213 br i1 %tmp133, label %bb78, label %bb134
215 bb134: ; preds = %bb129
216 %tmp135 = add nuw nsw i64 %tmp76, 1
217 %tmp136 = icmp eq i64 %tmp76, 0
218 br i1 %tmp136, label %bb75, label %bb137
220 bb137: ; preds = %bb134
221 %tmp138 = add nuw nsw i64 %tmp72, 1
222 %tmp139 = icmp eq i64 %tmp72, 0
223 br i1 %tmp139, label %bb71, label %bb140
225 bb140: ; preds = %bb137
226 %tmp141 = add nuw nsw i64 %tmp70, 1
227 %tmp142 = icmp eq i64 %tmp70, 0
228 br i1 %tmp142, label %bb69, label %bb143
230 bb143: ; preds = %bb140
231 %tmp144 = getelementptr inbounds ptr, ptr %arg3, i64 2
232 %tmp146 = load ptr, ptr %tmp144, align 8, !invariant.load !0, !dereferenceable !16, !align !2
235 bb147: ; preds = %bb143
238 bb148: ; preds = %bb147
241 bb149: ; preds = %bb148
242 %tmp151 = load float, ptr %tmp67, align 4, !alias.scope !13, !noalias !14
243 store float %tmp151, ptr %tmp146, align 4, !alias.scope !17, !noalias !13
244 %tmp153 = getelementptr inbounds [2 x [1 x [2 x [2 x [2 x float]]]]], ptr %tmp67, i64 0, i64 0, i64 0, i64 1, i64 0, i64 0
245 %tmp154 = load float, ptr %tmp153, align 4, !alias.scope !13, !noalias !14
246 %tmp155 = getelementptr inbounds [4 x [2 x [1 x [2 x float]]]], ptr %tmp146, i64 0, i64 0, i64 0, i64 0, i64 1
247 store float %tmp154, ptr %tmp155, align 4, !alias.scope !17, !noalias !13
250 bb156: ; preds = %bb149
251 %tmp157 = getelementptr inbounds [2 x [1 x [2 x [2 x [2 x float]]]]], ptr %tmp67, i64 0, i64 1, i64 0, i64 0, i64 0, i64 0
252 %tmp158 = load float, ptr %tmp157, align 4, !alias.scope !13, !noalias !14
253 %tmp159 = getelementptr inbounds [4 x [2 x [1 x [2 x float]]]], ptr %tmp146, i64 0, i64 0, i64 1, i64 0, i64 0
254 store float %tmp158, ptr %tmp159, align 4, !alias.scope !17, !noalias !13
255 %tmp160 = getelementptr inbounds [2 x [1 x [2 x [2 x [2 x float]]]]], ptr %tmp67, i64 0, i64 1, i64 0, i64 1, i64 0, i64 0
256 %tmp161 = load float, ptr %tmp160, align 4, !alias.scope !13, !noalias !14
257 %tmp162 = getelementptr inbounds [4 x [2 x [1 x [2 x float]]]], ptr %tmp146, i64 0, i64 0, i64 1, i64 0, i64 1
258 store float %tmp161, ptr %tmp162, align 4, !alias.scope !17, !noalias !13
261 bb163: ; preds = %bb156
264 bb164: ; preds = %bb163
265 %tmp165 = getelementptr inbounds [2 x [1 x [2 x [2 x [2 x float]]]]], ptr %tmp67, i64 0, i64 0, i64 0, i64 0, i64 0, i64 1
266 %tmp166 = load float, ptr %tmp165, align 4, !alias.scope !13, !noalias !14
267 %tmp167 = getelementptr inbounds [4 x [2 x [1 x [2 x float]]]], ptr %tmp146, i64 0, i64 1, i64 0, i64 0, i64 0
268 store float %tmp166, ptr %tmp167, align 4, !alias.scope !17, !noalias !13
269 %tmp168 = getelementptr inbounds [2 x [1 x [2 x [2 x [2 x float]]]]], ptr %tmp67, i64 0, i64 0, i64 0, i64 1, i64 0, i64 1
270 %tmp169 = load float, ptr %tmp168, align 4, !alias.scope !13, !noalias !14
271 %tmp170 = getelementptr inbounds [4 x [2 x [1 x [2 x float]]]], ptr %tmp146, i64 0, i64 1, i64 0, i64 0, i64 1
272 store float %tmp169, ptr %tmp170, align 4, !alias.scope !17, !noalias !13
275 bb171: ; preds = %bb164
276 %tmp172 = getelementptr inbounds [2 x [1 x [2 x [2 x [2 x float]]]]], ptr %tmp67, i64 0, i64 1, i64 0, i64 0, i64 0, i64 1
277 %tmp173 = load float, ptr %tmp172, align 4, !alias.scope !13, !noalias !14
278 %tmp174 = getelementptr inbounds [4 x [2 x [1 x [2 x float]]]], ptr %tmp146, i64 0, i64 1, i64 1, i64 0, i64 0
279 store float %tmp173, ptr %tmp174, align 4, !alias.scope !17, !noalias !13
280 %tmp175 = getelementptr inbounds [2 x [1 x [2 x [2 x [2 x float]]]]], ptr %tmp67, i64 0, i64 1, i64 0, i64 1, i64 0, i64 1
281 %tmp176 = load float, ptr %tmp175, align 4, !alias.scope !13, !noalias !14
282 %tmp177 = getelementptr inbounds [4 x [2 x [1 x [2 x float]]]], ptr %tmp146, i64 0, i64 1, i64 1, i64 0, i64 1
283 store float %tmp176, ptr %tmp177, align 4, !alias.scope !17, !noalias !13
286 bb178: ; preds = %bb171
289 bb179: ; preds = %bb178
290 %tmp180 = getelementptr inbounds [2 x [1 x [2 x [2 x [2 x float]]]]], ptr %tmp67, i64 0, i64 0, i64 0, i64 0, i64 1, i64 0
291 %tmp181 = load float, ptr %tmp180, align 4, !alias.scope !13, !noalias !14
292 %tmp182 = getelementptr inbounds [4 x [2 x [1 x [2 x float]]]], ptr %tmp146, i64 0, i64 2, i64 0, i64 0, i64 0
293 store float %tmp181, ptr %tmp182, align 4, !alias.scope !17, !noalias !13
294 %tmp183 = getelementptr inbounds [2 x [1 x [2 x [2 x [2 x float]]]]], ptr %tmp67, i64 0, i64 0, i64 0, i64 1, i64 1, i64 0
295 %tmp184 = load float, ptr %tmp183, align 4, !alias.scope !13, !noalias !14
296 %tmp185 = getelementptr inbounds [4 x [2 x [1 x [2 x float]]]], ptr %tmp146, i64 0, i64 2, i64 0, i64 0, i64 1
297 store float %tmp184, ptr %tmp185, align 4, !alias.scope !17, !noalias !13
300 bb186: ; preds = %bb179
301 %tmp187 = getelementptr inbounds [2 x [1 x [2 x [2 x [2 x float]]]]], ptr %tmp67, i64 0, i64 1, i64 0, i64 0, i64 1, i64 0
302 %tmp188 = load float, ptr %tmp187, align 4, !alias.scope !13, !noalias !14
303 %tmp189 = getelementptr inbounds [4 x [2 x [1 x [2 x float]]]], ptr %tmp146, i64 0, i64 2, i64 1, i64 0, i64 0
304 store float %tmp188, ptr %tmp189, align 4, !alias.scope !17, !noalias !13
305 %tmp190 = getelementptr inbounds [2 x [1 x [2 x [2 x [2 x float]]]]], ptr %tmp67, i64 0, i64 1, i64 0, i64 1, i64 1, i64 0
306 %tmp191 = load float, ptr %tmp190, align 4, !alias.scope !13, !noalias !14
307 %tmp192 = getelementptr inbounds [4 x [2 x [1 x [2 x float]]]], ptr %tmp146, i64 0, i64 2, i64 1, i64 0, i64 1
308 store float %tmp191, ptr %tmp192, align 4, !alias.scope !17, !noalias !13
311 bb193: ; preds = %bb186
314 bb194: ; preds = %bb193
315 %tmp195 = getelementptr inbounds [2 x [1 x [2 x [2 x [2 x float]]]]], ptr %tmp67, i64 0, i64 0, i64 0, i64 0, i64 1, i64 1
316 %tmp196 = load float, ptr %tmp195, align 4, !alias.scope !13, !noalias !14
317 %tmp197 = getelementptr inbounds [4 x [2 x [1 x [2 x float]]]], ptr %tmp146, i64 0, i64 3, i64 0, i64 0, i64 0
318 store float %tmp196, ptr %tmp197, align 4, !alias.scope !17, !noalias !13
319 %tmp198 = getelementptr inbounds [2 x [1 x [2 x [2 x [2 x float]]]]], ptr %tmp67, i64 0, i64 0, i64 0, i64 1, i64 1, i64 1
320 %tmp199 = load float, ptr %tmp198, align 4, !alias.scope !13, !noalias !14
321 %tmp200 = getelementptr inbounds [4 x [2 x [1 x [2 x float]]]], ptr %tmp146, i64 0, i64 3, i64 0, i64 0, i64 1
322 store float %tmp199, ptr %tmp200, align 4, !alias.scope !17, !noalias !13
325 bb201: ; preds = %bb194
326 %tmp202 = getelementptr inbounds [2 x [1 x [2 x [2 x [2 x float]]]]], ptr %tmp67, i64 0, i64 1, i64 0, i64 0, i64 1, i64 1
327 %tmp203 = load float, ptr %tmp202, align 4, !alias.scope !13, !noalias !14
328 %tmp204 = getelementptr inbounds [4 x [2 x [1 x [2 x float]]]], ptr %tmp146, i64 0, i64 3, i64 1, i64 0, i64 0
329 store float %tmp203, ptr %tmp204, align 4, !alias.scope !17, !noalias !13
330 %tmp205 = getelementptr inbounds [2 x [1 x [2 x [2 x [2 x float]]]]], ptr %tmp67, i64 0, i64 1, i64 0, i64 1, i64 1, i64 1
331 %tmp206 = load float, ptr %tmp205, align 4, !alias.scope !13, !noalias !14
332 %tmp207 = getelementptr inbounds [4 x [2 x [1 x [2 x float]]]], ptr %tmp146, i64 0, i64 3, i64 1, i64 0, i64 1
333 store float %tmp206, ptr %tmp207, align 4, !alias.scope !17, !noalias !13
337 attributes #0 = { nofree norecurse nounwind uwtable "denormal-fp-math"="preserve-sign" "no-frame-pointer-elim"="false" }
344 !5 = !{!"buffer: {index:3, offset:0, size:800}", !6}
345 !6 = !{!"XLA global AA domain"}
347 !8 = !{!"buffer: {index:3, offset:800, size:672}", !6}
348 !9 = !{!"buffer: {index:3, offset:1472, size:64}", !6}
354 !15 = !{!"buffer: {index:2, offset:0, size:64}", !6}