1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
| ; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s
;
; #define N 400
;
; void first_higher_dimensional(float A[][N]) {
; for (long i = 0; i < N; i++)
; for (long j = 0; j < N; j++)
; A[i][j] += i + j;
;
; A[0][0] += A[100][100];
;
; for (long i = 0; i < N; i++)
; for (long j = 0; j < N; j++)
; A[i][j] += i + j;
; }
; void first_lower_dimensional(float A[][N], float B[][N]) {
; for (long i = 0; i < N; i++)
; for (long j = 0; j < N; j++)
; B[i][j] += i + j;
;
; A[0][0] += B[100][100];
;
; for (long i = 0; i < N; i++)
; for (long j = 0; j < N; j++)
; A[i][j] += i + j;
; }
; CHECK: Statements {
; CHECK-NEXT: Stmt_bb7
; CHECK-NEXT: Domain :=
; CHECK-NEXT: { Stmt_bb7[i0, i1] : 0 <= i0 <= 399 and 0 <= i1 <= 399 };
; CHECK-NEXT: Schedule :=
; CHECK-NEXT: { Stmt_bb7[i0, i1] -> [0, i0, i1] };
; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: { Stmt_bb7[i0, i1] -> MemRef_A[i0, i1] };
; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: { Stmt_bb7[i0, i1] -> MemRef_A[i0, i1] };
; CHECK-NEXT: Stmt_bb17
; CHECK-NEXT: Domain :=
; CHECK-NEXT: { Stmt_bb17[] };
; CHECK-NEXT: Schedule :=
; CHECK-NEXT: { Stmt_bb17[] -> [1, 0, 0] };
; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: { Stmt_bb17[] -> MemRef_A[100, 100] };
; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: { Stmt_bb17[] -> MemRef_A[0, 0] };
; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: { Stmt_bb17[] -> MemRef_A[0, 0] };
; CHECK-NEXT: Stmt_bb26
; CHECK-NEXT: Domain :=
; CHECK-NEXT: { Stmt_bb26[i0, i1] : 0 <= i0 <= 399 and 0 <= i1 <= 399 };
; CHECK-NEXT: Schedule :=
; CHECK-NEXT: { Stmt_bb26[i0, i1] -> [2, i0, i1] };
; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: { Stmt_bb26[i0, i1] -> MemRef_A[i0, i1] };
; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: { Stmt_bb26[i0, i1] -> MemRef_A[i0, i1] };
; CHECK-NEXT: }
;
; CHECK: Statements {
; CHECK-NEXT: Stmt_bb7
; CHECK-NEXT: Domain :=
; CHECK-NEXT: { Stmt_bb7[i0, i1] : 0 <= i0 <= 399 and 0 <= i1 <= 399 };
; CHECK-NEXT: Schedule :=
; CHECK-NEXT: { Stmt_bb7[i0, i1] -> [0, i0, i1] };
; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: { Stmt_bb7[i0, i1] -> MemRef_B[i0, i1] };
; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: { Stmt_bb7[i0, i1] -> MemRef_B[i0, i1] };
; CHECK-NEXT: Stmt_bb17
; CHECK-NEXT: Domain :=
; CHECK-NEXT: { Stmt_bb17[] };
; CHECK-NEXT: Schedule :=
; CHECK-NEXT: { Stmt_bb17[] -> [1, 0, 0] };
; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: { Stmt_bb17[] -> MemRef_B[100, 100] };
; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: { Stmt_bb17[] -> MemRef_A[0, 0] };
; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: { Stmt_bb17[] -> MemRef_A[0, 0] };
; CHECK-NEXT: Stmt_bb26
; CHECK-NEXT: Domain :=
; CHECK-NEXT: { Stmt_bb26[i0, i1] : 0 <= i0 <= 399 and 0 <= i1 <= 399 };
; CHECK-NEXT: Schedule :=
; CHECK-NEXT: { Stmt_bb26[i0, i1] -> [2, i0, i1] };
; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: { Stmt_bb26[i0, i1] -> MemRef_A[i0, i1] };
; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: { Stmt_bb26[i0, i1] -> MemRef_A[i0, i1] };
; CHECK-NEXT: }
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
define void @first_higher_dimensional([400 x float]* %A) {
bb:
br label %bb4
bb4: ; preds = %bb15, %bb
%i.0 = phi i64 [ 0, %bb ], [ %tmp16, %bb15 ]
%exitcond3 = icmp ne i64 %i.0, 400
br i1 %exitcond3, label %bb5, label %bb17
bb5: ; preds = %bb4
br label %bb6
bb6: ; preds = %bb12, %bb5
%j.0 = phi i64 [ 0, %bb5 ], [ %tmp13, %bb12 ]
%exitcond2 = icmp ne i64 %j.0, 400
br i1 %exitcond2, label %bb7, label %bb14
bb7: ; preds = %bb6
%tmp = add nuw nsw i64 %i.0, %j.0
%tmp8 = sitofp i64 %tmp to float
%tmp9 = getelementptr inbounds [400 x float], [400 x float]* %A, i64 %i.0, i64 %j.0
%tmp10 = load float, float* %tmp9, align 4
%tmp11 = fadd float %tmp10, %tmp8
store float %tmp11, float* %tmp9, align 4
br label %bb12
bb12: ; preds = %bb7
%tmp13 = add nuw nsw i64 %j.0, 1
br label %bb6
bb14: ; preds = %bb6
br label %bb15
bb15: ; preds = %bb14
%tmp16 = add nuw nsw i64 %i.0, 1
br label %bb4
bb17: ; preds = %bb4
%tmp18 = getelementptr inbounds [400 x float], [400 x float]* %A, i64 100, i64 100
%tmp19 = load float, float* %tmp18, align 4
%tmp20 = getelementptr inbounds [400 x float], [400 x float]* %A, i64 0, i64 0
%tmp21 = load float, float* %tmp20, align 4
%tmp22 = fadd float %tmp21, %tmp19
store float %tmp22, float* %tmp20, align 4
br label %bb23
bb23: ; preds = %bb35, %bb17
%i1.0 = phi i64 [ 0, %bb17 ], [ %tmp36, %bb35 ]
%exitcond1 = icmp ne i64 %i1.0, 400
br i1 %exitcond1, label %bb24, label %bb37
bb24: ; preds = %bb23
br label %bb25
bb25: ; preds = %bb32, %bb24
%j2.0 = phi i64 [ 0, %bb24 ], [ %tmp33, %bb32 ]
%exitcond = icmp ne i64 %j2.0, 400
br i1 %exitcond, label %bb26, label %bb34
bb26: ; preds = %bb25
%tmp27 = add nuw nsw i64 %i1.0, %j2.0
%tmp28 = sitofp i64 %tmp27 to float
%tmp29 = getelementptr inbounds [400 x float], [400 x float]* %A, i64 %i1.0, i64 %j2.0
%tmp30 = load float, float* %tmp29, align 4
%tmp31 = fadd float %tmp30, %tmp28
store float %tmp31, float* %tmp29, align 4
br label %bb32
bb32: ; preds = %bb26
%tmp33 = add nuw nsw i64 %j2.0, 1
br label %bb25
bb34: ; preds = %bb25
br label %bb35
bb35: ; preds = %bb34
%tmp36 = add nuw nsw i64 %i1.0, 1
br label %bb23
bb37: ; preds = %bb23
ret void
}
define void @first_lower_dimensional([400 x float]* %A, [400 x float]* %B) {
bb:
br label %bb4
bb4: ; preds = %bb15, %bb
%i.0 = phi i64 [ 0, %bb ], [ %tmp16, %bb15 ]
%exitcond3 = icmp ne i64 %i.0, 400
br i1 %exitcond3, label %bb5, label %bb17
bb5: ; preds = %bb4
br label %bb6
bb6: ; preds = %bb12, %bb5
%j.0 = phi i64 [ 0, %bb5 ], [ %tmp13, %bb12 ]
%exitcond2 = icmp ne i64 %j.0, 400
br i1 %exitcond2, label %bb7, label %bb14
bb7: ; preds = %bb6
%tmp = add nuw nsw i64 %i.0, %j.0
%tmp8 = sitofp i64 %tmp to float
%tmp9 = getelementptr inbounds [400 x float], [400 x float]* %B, i64 %i.0, i64 %j.0
%tmp10 = load float, float* %tmp9, align 4
%tmp11 = fadd float %tmp10, %tmp8
store float %tmp11, float* %tmp9, align 4
br label %bb12
bb12: ; preds = %bb7
%tmp13 = add nuw nsw i64 %j.0, 1
br label %bb6
bb14: ; preds = %bb6
br label %bb15
bb15: ; preds = %bb14
%tmp16 = add nuw nsw i64 %i.0, 1
br label %bb4
bb17: ; preds = %bb4
%tmp18 = getelementptr inbounds [400 x float], [400 x float]* %B, i64 100, i64 100
%tmp19 = load float, float* %tmp18, align 4
%tmp20 = getelementptr inbounds [400 x float], [400 x float]* %A, i64 0, i64 0
%tmp21 = load float, float* %tmp20, align 4
%tmp22 = fadd float %tmp21, %tmp19
store float %tmp22, float* %tmp20, align 4
br label %bb23
bb23: ; preds = %bb35, %bb17
%i1.0 = phi i64 [ 0, %bb17 ], [ %tmp36, %bb35 ]
%exitcond1 = icmp ne i64 %i1.0, 400
br i1 %exitcond1, label %bb24, label %bb37
bb24: ; preds = %bb23
br label %bb25
bb25: ; preds = %bb32, %bb24
%j2.0 = phi i64 [ 0, %bb24 ], [ %tmp33, %bb32 ]
%exitcond = icmp ne i64 %j2.0, 400
br i1 %exitcond, label %bb26, label %bb34
bb26: ; preds = %bb25
%tmp27 = add nuw nsw i64 %i1.0, %j2.0
%tmp28 = sitofp i64 %tmp27 to float
%tmp29 = getelementptr inbounds [400 x float], [400 x float]* %A, i64 %i1.0, i64 %j2.0
%tmp30 = load float, float* %tmp29, align 4
%tmp31 = fadd float %tmp30, %tmp28
store float %tmp31, float* %tmp29, align 4
br label %bb32
bb32: ; preds = %bb26
%tmp33 = add nuw nsw i64 %j2.0, 1
br label %bb25
bb34: ; preds = %bb25
br label %bb35
bb35: ; preds = %bb34
%tmp36 = add nuw nsw i64 %i1.0, 1
br label %bb23
bb37: ; preds = %bb23
ret void
}
|