1 ; RUN: opt %loadPolly -polly-opt-isl -polly-print-ast -disable-output < %s | FileCheck %s
3 ; void jacobi1d(long T, long N, float *A, float *B) {
5 ; for (t = 0; t < T; t++) {
6 ; for (i = 1; i < N - 1; i++)
7 ; B[i] = 0.33333 * (A[i - 1] + A[i] + A[i + 1]);
8 ; for (j = 1; j < N - 1; j++)
9 ; A[j] = 0.33333 * (B[i - 1] + B[i] + B[i + 1]);
13 ; Verify that we do not tile bands that have just a single dimension.
15 ; CHECK: for (int c0 = 0; c0 < T; c0 += 1) {
16 ; CHECK: for (int c1 = 0; c1 < N - 2; c1 += 1)
17 ; CHECK: Stmt_for_body3(c0, c1);
18 ; CHECK: for (int c1 = 0; c1 < N - 2; c1 += 1)
19 ; CHECK: Stmt_for_body15(c0, c1);
22 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
24 define void @jacobi1d(i64 %T, i64 %N, ptr %A, ptr %B) {
27 %tmp1 = icmp sgt i64 %tmp, 1
28 %smax = select i1 %tmp1, i64 %tmp, i64 1
31 for.cond: ; preds = %for.inc30, %entry
32 %t.0 = phi i64 [ 0, %entry ], [ %inc31, %for.inc30 ]
33 %cmp = icmp slt i64 %t.0, %T
34 br i1 %cmp, label %for.body, label %for.end32
36 for.body: ; preds = %for.cond
39 for.cond1: ; preds = %for.inc, %for.body
40 %i.0 = phi i64 [ 1, %for.body ], [ %inc, %for.inc ]
41 %sub = add nsw i64 %N, -1
42 %cmp2 = icmp slt i64 %i.0, %sub
43 br i1 %cmp2, label %for.body3, label %for.end
45 for.body3: ; preds = %for.cond1
46 %sub4 = add nsw i64 %i.0, -1
47 %arrayidx = getelementptr inbounds float, ptr %A, i64 %sub4
48 %tmp2 = load float, ptr %arrayidx, align 4
49 %arrayidx5 = getelementptr inbounds float, ptr %A, i64 %i.0
50 %tmp3 = load float, ptr %arrayidx5, align 4
51 %add = fadd float %tmp2, %tmp3
52 %add6 = add nuw nsw i64 %i.0, 1
53 %arrayidx7 = getelementptr inbounds float, ptr %A, i64 %add6
54 %tmp4 = load float, ptr %arrayidx7, align 4
55 %add8 = fadd float %add, %tmp4
56 %conv = fpext float %add8 to double
57 %mul = fmul double %conv, 3.333300e-01
58 %conv9 = fptrunc double %mul to float
59 %arrayidx10 = getelementptr inbounds float, ptr %B, i64 %i.0
60 store float %conv9, ptr %arrayidx10, align 4
63 for.inc: ; preds = %for.body3
64 %inc = add nuw nsw i64 %i.0, 1
67 for.end: ; preds = %for.cond1
70 for.cond11: ; preds = %for.inc27, %for.end
71 %j.0 = phi i64 [ 1, %for.end ], [ %inc28, %for.inc27 ]
72 %sub12 = add nsw i64 %N, -1
73 %cmp13 = icmp slt i64 %j.0, %sub12
74 br i1 %cmp13, label %for.body15, label %for.end29
76 for.body15: ; preds = %for.cond11
77 %sub16 = add nsw i64 %smax, -1
78 %arrayidx17 = getelementptr inbounds float, ptr %B, i64 %sub16
79 %tmp5 = load float, ptr %arrayidx17, align 4
80 %arrayidx18 = getelementptr inbounds float, ptr %B, i64 %smax
81 %tmp6 = load float, ptr %arrayidx18, align 4
82 %add19 = fadd float %tmp5, %tmp6
83 %add20 = add nsw i64 %smax, 1
84 %arrayidx21 = getelementptr inbounds float, ptr %B, i64 %add20
85 %tmp7 = load float, ptr %arrayidx21, align 4
86 %add22 = fadd float %add19, %tmp7
87 %conv23 = fpext float %add22 to double
88 %mul24 = fmul double %conv23, 3.333300e-01
89 %conv25 = fptrunc double %mul24 to float
90 %arrayidx26 = getelementptr inbounds float, ptr %A, i64 %j.0
91 store float %conv25, ptr %arrayidx26, align 4
94 for.inc27: ; preds = %for.body15
95 %inc28 = add nuw nsw i64 %j.0, 1
98 for.end29: ; preds = %for.cond11
101 for.inc30: ; preds = %for.end29
102 %inc31 = add nuw nsw i64 %t.0, 1
105 for.end32: ; preds = %for.cond