1 ; RUN: opt %loadPolly -disable-output -polly-print-scops \
2 ; RUN: -polly-invariant-load-hoisting=true < %s | FileCheck %s
4 ; Check that propagation of domains from A(X) to A(X+1) will keep the
5 ; domains small and concise.
7 ; CHECK: Assumed Context:
8 ; CHECK-NEXT: [tmp5, tmp, tmp8, tmp11, tmp14, tmp17, tmp20, tmp23, tmp26] -> { : }
9 ; CHECK-NEXT: Invalid Context:
10 ; CHECK-NEXT: [tmp5, tmp, tmp8, tmp11, tmp14, tmp17, tmp20, tmp23, tmp26] -> { : false }
13 ; CHECK-NEXT: Domain :=
14 ; CHECK-NEXT: [tmp5, tmp, tmp8, tmp11, tmp14, tmp17, tmp20, tmp23, tmp26] -> { Stmt_FINAL[] };
15 ; CHECK-NEXT: Schedule :=
16 ; CHECK-NEXT: [tmp5, tmp, tmp8, tmp11, tmp14, tmp17, tmp20, tmp23, tmp26] -> { Stmt_FINAL[] -> [16] };
19 ; void f(short *restrict In, int *restrict Out) {
101 ; if (InV < V + 42) {
113 ; if (InV < V + 42) {
126 ; if (InV < V + 42) {
142 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
144 define void @f(ptr noalias %In, ptr noalias %Out) {
146 %tmp = load i16, ptr %In, align 2
147 %conv = sext i16 %tmp to i32
148 %cmp = icmp slt i16 %tmp, 1041
149 br i1 %cmp, label %B0, label %C0
152 %arrayidx4 = getelementptr inbounds i32, ptr %Out, i64 1041
153 %tmp3 = load i32, ptr %arrayidx4, align 4
154 %inc5 = add nsw i32 %tmp3, 1
155 store i32 %inc5, ptr %arrayidx4, align 4
159 %idxprom6 = sext i16 %tmp to i64
160 %arrayidx7 = getelementptr inbounds i32, ptr %Out, i64 %idxprom6
161 %tmp4 = load i32, ptr %arrayidx7, align 4
162 %dec = add nsw i32 %tmp4, -1
163 store i32 %dec, ptr %arrayidx7, align 4
166 A1: ; preds = %B0, %C0
167 %V.0 = phi i32 [ 1041, %B0 ], [ %conv, %C0 ]
168 %arrayidx10 = getelementptr inbounds i16, ptr %In, i64 1
169 %tmp5 = load i16, ptr %arrayidx10, align 2
170 %conv11 = sext i16 %tmp5 to i32
171 %add12 = add nsw i32 %V.0, 42
172 %cmp13 = icmp slt i32 %conv11, %add12
173 br i1 %cmp13, label %B1, label %C1
176 %add16 = add nsw i32 %V.0, 42
177 %idxprom17 = sext i32 %add16 to i64
178 %arrayidx18 = getelementptr inbounds i32, ptr %Out, i64 %idxprom17
179 %tmp6 = load i32, ptr %arrayidx18, align 4
180 %inc19 = add nsw i32 %tmp6, 1
181 store i32 %inc19, ptr %arrayidx18, align 4
185 %idxprom21 = sext i16 %tmp5 to i64
186 %arrayidx22 = getelementptr inbounds i32, ptr %Out, i64 %idxprom21
187 %tmp7 = load i32, ptr %arrayidx22, align 4
188 %dec23 = add nsw i32 %tmp7, -1
189 store i32 %dec23, ptr %arrayidx22, align 4
192 A2: ; preds = %B1, %C1
193 %arrayidx27 = getelementptr inbounds i16, ptr %In, i64 2
194 %tmp8 = load i16, ptr %arrayidx27, align 2
195 %conv28 = sext i16 %tmp8 to i32
196 %cmp30 = icmp slt i16 %tmp8, 1041
197 br i1 %cmp30, label %B2, label %C2
200 %arrayidx35 = getelementptr inbounds i32, ptr %Out, i64 1041
201 %tmp9 = load i32, ptr %arrayidx35, align 4
202 %inc36 = add nsw i32 %tmp9, 1
203 store i32 %inc36, ptr %arrayidx35, align 4
207 %idxprom38 = sext i16 %tmp8 to i64
208 %arrayidx39 = getelementptr inbounds i32, ptr %Out, i64 %idxprom38
209 %tmp10 = load i32, ptr %arrayidx39, align 4
210 %dec40 = add nsw i32 %tmp10, -1
211 store i32 %dec40, ptr %arrayidx39, align 4
214 A3: ; preds = %B2, %C2
215 %V.1 = phi i32 [ 1041, %B2 ], [ %conv28, %C2 ]
216 %arrayidx44 = getelementptr inbounds i16, ptr %In, i64 3
217 %tmp11 = load i16, ptr %arrayidx44, align 2
218 %conv45 = sext i16 %tmp11 to i32
219 %add46 = add nsw i32 %V.1, 42
220 %cmp47 = icmp slt i32 %conv45, %add46
221 br i1 %cmp47, label %B3, label %C3
224 %add50 = add nsw i32 %V.1, 42
225 %idxprom51 = sext i32 %add50 to i64
226 %arrayidx52 = getelementptr inbounds i32, ptr %Out, i64 %idxprom51
227 %tmp12 = load i32, ptr %arrayidx52, align 4
228 %inc53 = add nsw i32 %tmp12, 1
229 store i32 %inc53, ptr %arrayidx52, align 4
233 %idxprom55 = sext i16 %tmp11 to i64
234 %arrayidx56 = getelementptr inbounds i32, ptr %Out, i64 %idxprom55
235 %tmp13 = load i32, ptr %arrayidx56, align 4
236 %dec57 = add nsw i32 %tmp13, -1
237 store i32 %dec57, ptr %arrayidx56, align 4
240 A4: ; preds = %B3, %C3
241 %arrayidx61 = getelementptr inbounds i16, ptr %In, i64 4
242 %tmp14 = load i16, ptr %arrayidx61, align 2
243 %conv62 = sext i16 %tmp14 to i32
244 %cmp64 = icmp slt i16 %tmp14, 1041
245 br i1 %cmp64, label %B4, label %C4
248 %arrayidx69 = getelementptr inbounds i32, ptr %Out, i64 1041
249 %tmp15 = load i32, ptr %arrayidx69, align 4
250 %inc70 = add nsw i32 %tmp15, 1
251 store i32 %inc70, ptr %arrayidx69, align 4
255 %idxprom72 = sext i16 %tmp14 to i64
256 %arrayidx73 = getelementptr inbounds i32, ptr %Out, i64 %idxprom72
257 %tmp16 = load i32, ptr %arrayidx73, align 4
258 %dec74 = add nsw i32 %tmp16, -1
259 store i32 %dec74, ptr %arrayidx73, align 4
260 %phitmp = add nsw i32 %conv62, 42
263 A5: ; preds = %B4, %C4
264 %V.2 = phi i32 [ 1083, %B4 ], [ %phitmp, %C4 ]
265 %arrayidx78 = getelementptr inbounds i16, ptr %In, i64 5
266 %tmp17 = load i16, ptr %arrayidx78, align 2
267 %conv79 = sext i16 %tmp17 to i32
268 %cmp81 = icmp slt i32 %conv79, %V.2
269 br i1 %cmp81, label %B5, label %C5
272 %idxprom85 = sext i32 %V.2 to i64
273 %arrayidx86 = getelementptr inbounds i32, ptr %Out, i64 %idxprom85
274 %tmp18 = load i32, ptr %arrayidx86, align 4
275 %inc87 = add nsw i32 %tmp18, 1
276 store i32 %inc87, ptr %arrayidx86, align 4
280 %idxprom89 = sext i16 %tmp17 to i64
281 %arrayidx90 = getelementptr inbounds i32, ptr %Out, i64 %idxprom89
282 %tmp19 = load i32, ptr %arrayidx90, align 4
283 %dec91 = add nsw i32 %tmp19, -1
284 store i32 %dec91, ptr %arrayidx90, align 4
287 A6: ; preds = %B5, %C5
288 %arrayidx95 = getelementptr inbounds i16, ptr %In, i64 6
289 %tmp20 = load i16, ptr %arrayidx95, align 2
290 %conv96 = sext i16 %tmp20 to i32
291 %cmp98 = icmp slt i16 %tmp20, 1041
292 br i1 %cmp98, label %B6, label %C6
295 %arrayidx103 = getelementptr inbounds i32, ptr %Out, i64 1041
296 %tmp21 = load i32, ptr %arrayidx103, align 4
297 %inc104 = add nsw i32 %tmp21, 1
298 store i32 %inc104, ptr %arrayidx103, align 4
302 %idxprom106 = sext i16 %tmp20 to i64
303 %arrayidx107 = getelementptr inbounds i32, ptr %Out, i64 %idxprom106
304 %tmp22 = load i32, ptr %arrayidx107, align 4
305 %dec108 = add nsw i32 %tmp22, -1
306 store i32 %dec108, ptr %arrayidx107, align 4
307 %phitmp1 = add nsw i32 %conv96, 42
310 A7: ; preds = %B6, %C6
311 %V.3 = phi i32 [ 1083, %B6 ], [ %phitmp1, %C6 ]
312 %arrayidx112 = getelementptr inbounds i16, ptr %In, i64 7
313 %tmp23 = load i16, ptr %arrayidx112, align 2
314 %conv113 = sext i16 %tmp23 to i32
315 %cmp115 = icmp slt i32 %conv113, %V.3
316 br i1 %cmp115, label %B7, label %C7
319 %idxprom119 = sext i32 %V.3 to i64
320 %arrayidx120 = getelementptr inbounds i32, ptr %Out, i64 %idxprom119
321 %tmp24 = load i32, ptr %arrayidx120, align 4
322 %inc121 = add nsw i32 %tmp24, 1
323 store i32 %inc121, ptr %arrayidx120, align 4
327 %idxprom123 = sext i16 %tmp23 to i64
328 %arrayidx124 = getelementptr inbounds i32, ptr %Out, i64 %idxprom123
329 %tmp25 = load i32, ptr %arrayidx124, align 4
330 %dec125 = add nsw i32 %tmp25, -1
331 store i32 %dec125, ptr %arrayidx124, align 4
334 A8: ; preds = %B7, %C7
335 %arrayidx129 = getelementptr inbounds i16, ptr %In, i64 8
336 %tmp26 = load i16, ptr %arrayidx129, align 2
337 %cmp132 = icmp slt i16 %tmp26, 1041
338 br i1 %cmp132, label %B8, label %C8
341 %arrayidx137 = getelementptr inbounds i32, ptr %Out, i64 1041
342 %tmp27 = load i32, ptr %arrayidx137, align 4
343 %inc138 = add nsw i32 %tmp27, 1
344 store i32 %inc138, ptr %arrayidx137, align 4
348 %idxprom140 = sext i16 %tmp26 to i64
349 %arrayidx141 = getelementptr inbounds i32, ptr %Out, i64 %idxprom140
350 %tmp28 = load i32, ptr %arrayidx141, align 4
351 %dec142 = add nsw i32 %tmp28, -1
352 store i32 %dec142, ptr %arrayidx141, align 4
353 %phitmp2 = sext i16 %tmp26 to i64
356 FINAL: ; preds = %C8, %B8
357 %V.4 = phi i64 [ 1041, %B8 ], [ %phitmp2, %C8 ]
358 %arrayidx145 = getelementptr inbounds i32, ptr %Out, i64 %V.4
359 %tmp29 = load i32, ptr %arrayidx145, align 4
360 %inc146 = add nsw i32 %tmp29, 1
361 store i32 %inc146, ptr %arrayidx145, align 4