• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -S %loadPolly -basic-aa -polly-dependences -analyze -polly-dependences-analysis-type=value-based < %s | FileCheck %s -check-prefix=VALUE
2; RUN: opt -S %loadPolly -basic-aa -polly-dependences -analyze -polly-dependences-analysis-type=memory-based < %s | FileCheck %s -check-prefix=MEMORY
3; RUN: opt -S %loadPolly -basic-aa -polly-dependences -analyze -polly-dependences-analysis-type=value-based -polly-dependences-analysis-level=access-wise < %s | FileCheck %s -check-prefix=VALUE_ACCESS
4
5; VALUE-LABEL: Printing analysis 'Polly - Calculate dependences' for region: 'S1 => exit.3' in function 'sequential_writes':
6; VALUE-NEXT:      RAW dependences:
7; VALUE-NEXT:          {  }
8; VALUE-NEXT:      WAR dependences:
9; VALUE-NEXT:          {  }
10; VALUE-NEXT:      WAW dependences:
11; VALUE-NEXT:          { Stmt_S1[i0] -> Stmt_S2[i0] : 0 <= i0 <= 9; Stmt_S2[i0] -> Stmt_S3[i0] : 0 <= i0 <= 9; Stmt_S1[i0] -> Stmt_S3[i0] : 10 <= i0 <= 99 }
12;
13;VALUE_ACCESS-LABEL: Printing analysis 'Polly - Calculate dependences' for region: 'S1 => exit.3' in function 'sequential_writes':
14;VALUE_ACCESS-NEXT:        RAW dependences:
15;VALUE_ACCESS-NEXT:                {  }
16;VALUE_ACCESS-NEXT:        WAR dependences:
17;VALUE_ACCESS-NEXT:                {  }
18;VALUE_ACCESS-NEXT:        WAW dependences:
19;VALUE_ACCESS-NEXT:                { Stmt_S1[i0] -> Stmt_S2[i0] : 0 <= i0 <= 9; [Stmt_S1[i0] -> Stmt_S1_Write0[]] -> [Stmt_S2[i0] -> Stmt_S2_Write0[]] : 0 <= i0 <= 9; Stmt_S2[i0] -> Stmt_S3[i0] : 0 <= i0 <= 9; [Stmt_S2[i0] -> Stmt_S2_Write0[]] -> [Stmt_S3[i0] -> Stmt_S3_Write0[]] : 0 <= i0 <= 9; [Stmt_S1[i0] -> Stmt_S1_Write0[]] -> [Stmt_S3[i0] -> Stmt_S3_Write0[]] : 10 <= i0 <= 99; Stmt_S1[i0] -> Stmt_S3[i0] : 10 <= i0 <= 99 }
20
21;
22; VALUE-LABEL: Printing analysis 'Polly - Calculate dependences' for region: 'S1 => exit.3' in function 'read_after_writes':
23; VALUE-NEXT:      RAW dependences:
24; VALUE-NEXT:          { Stmt_S2[i0] -> Stmt_S3[i0] : 0 <= i0 <= 9; Stmt_S1[i0] -> Stmt_S3[i0] : 10 <= i0 <= 99 }
25; VALUE-NEXT:      WAR dependences:
26; VALUE-NEXT:          {  }
27; VALUE-NEXT:      WAW dependences:
28; VALUE-NEXT:          { Stmt_S1[i0] -> Stmt_S2[i0] : 0 <= i0 <= 9 }
29;
30;VALUE_ACCESS-LABEL: Printing analysis 'Polly - Calculate dependences' for region: 'S1 => exit.3' in function 'read_after_writes':
31;VALUE_ACCESS-NEXT:        RAW dependences:
32;VALUE_ACCESS-NEXT:                { [Stmt_S1[i0] -> Stmt_S1_Write0[]] -> [Stmt_S3[i0] -> Stmt_S3_Read0[]] : 10 <= i0 <= 99; [Stmt_S2[i0] -> Stmt_S2_Write0[]] -> [Stmt_S3[i0] -> Stmt_S3_Read0[]] : 0 <= i0 <= 9; Stmt_S2[i0] -> Stmt_S3[i0] : 0 <= i0 <= 9; Stmt_S1[i0] -> Stmt_S3[i0] : 10 <= i0 <= 99 }
33
34;VALUE_ACCESS-NEXT:        WAR dependences:
35;VALUE_ACCESS-NEXT:                {  }
36;VALUE_ACCESS-NEXT:        WAW dependences:
37;VALUE_ACCESS-NEXT:                { Stmt_S1[i0] -> Stmt_S2[i0] : 0 <= i0 <= 9; [Stmt_S1[i0] -> Stmt_S1_Write0[]] -> [Stmt_S2[i0] -> Stmt_S2_Write0[]] : 0 <= i0 <= 9 }
38;
39; VALUE-LABEL: Printing analysis 'Polly - Calculate dependences' for region: 'S1 => exit.3' in function 'write_after_read':
40; VALUE-NEXT:      RAW dependences:
41; VALUE-NEXT:          {  }
42; VALUE-NEXT:      WAR dependences:
43; VALUE-NEXT:          { Stmt_S1[i0] -> Stmt_S2[i0] : 0 <= i0 <= 9; Stmt_S1[i0] -> Stmt_S3[i0] : 10 <= i0 <= 99 }
44; VALUE-NEXT:      WAW dependences:
45; VALUE-NEXT:          { Stmt_S2[i0] -> Stmt_S3[i0] : 0 <= i0 <= 9 }
46;
47;VALUE_ACCESS-LABEL: Printing analysis 'Polly - Calculate dependences' for region: 'S1 => exit.3' in function 'write_after_read':
48;VALUE_ACCESS-NEXT:         RAW dependences:
49;VALUE_ACCESS-NEXT:                 {  }
50;VALUE_ACCESS-NEXT:         WAR dependences:
51;VALUE_ACCESS-NEXT:                { Stmt_S1[i0] -> Stmt_S2[i0] : 0 <= i0 <= 9; [Stmt_S1[i0] -> Stmt_S1_Read0[]] -> [Stmt_S2[i0] -> Stmt_S2_Write0[]] : 0 <= i0 <= 9; [Stmt_S1[i0] -> Stmt_S1_Read0[]] -> [Stmt_S3[i0] -> Stmt_S3_Write0[]] : 10 <= i0 <= 99; Stmt_S1[i0] -> Stmt_S3[i0] : 10 <= i0 <= 99 }
52;VALUE_ACCESS-NEXT:         WAW dependences:
53;VALUE_ACCESS-NEXT:                { Stmt_S2[i0] -> Stmt_S3[i0] : 0 <= i0 <= 9; [Stmt_S2[i0] -> Stmt_S2_Write0[]] -> [Stmt_S3[i0] -> Stmt_S3_Write0[]] : 0 <= i0 <= 9 }
54;
55; VALUE-LABEL: Printing analysis 'Polly - Calculate dependences' for region: 'S1 => exit.2' in function 'parametric_offset':
56; VALUE-NEXT:      RAW dependences:
57; VALUE-NEXT:          [p] -> { Stmt_S1[i0] -> Stmt_S2[-p + i0] : i0 >= p and 0 <= i0 <= 99 and i0 <= 9 + p }
58; VALUE-NEXT:      WAR dependences:
59; VALUE-NEXT:          [p] -> {  }
60; VALUE-NEXT:      WAW dependences:
61; VALUE-NEXT:          [p] -> {  }
62;
63;VALUE_ACCESS-LABEL: Printing analysis 'Polly - Calculate dependences' for region: 'S1 => exit.2' in function 'parametric_offset':
64;VALUE_ACCESS-NEXT:        RAW dependences:
65;VALUE_ACCESS-NEXT:                [p] -> { [Stmt_S1[i0] -> Stmt_S1_Write0[]] -> [Stmt_S2[-p + i0] -> Stmt_S2_Read0[]] : i0 >= p and 0 <= i0 <= 99 and i0 <= 9 + p; Stmt_S1[i0] -> Stmt_S2[-p + i0] : i0 >= p and 0 <= i0 <= 99 and i0 <= 9 + p }
66;VALUE_ACCESS-NEXT:        WAR dependences:
67;VALUE_ACCESS-NEXT:                [p] -> {  }
68;VALUE_ACCESS-NEXT:        WAW dependences:
69;VALUE_ACCESS-NEXT:                [p] -> {  }
70
71; MEMORY-LABEL: Printing analysis 'Polly - Calculate dependences' for region: 'S1 => exit.3' in function 'sequential_writes':
72; MEMORY-NEXT:      RAW dependences:
73; MEMORY-NEXT:          {  }
74; MEMORY-NEXT:      WAR dependences:
75; MEMORY-NEXT:          {  }
76; MEMORY-NEXT:      WAW dependences:
77; MEMORY-NEXT:          { Stmt_S1[i0] -> Stmt_S2[i0] : 0 <= i0 <= 9; Stmt_S2[i0] -> Stmt_S3[i0] : 0 <= i0 <= 9; Stmt_S1[i0] -> Stmt_S3[i0] : 0 <= i0 <= 99 }
78;
79; MEMORY-LABEL: Printing analysis 'Polly - Calculate dependences' for region: 'S1 => exit.3' in function 'read_after_writes':
80; MEMORY-NEXT:      RAW dependences:
81; MEMORY-NEXT:          { Stmt_S2[i0] -> Stmt_S3[i0] : 0 <= i0 <= 9; Stmt_S1[i0] -> Stmt_S3[i0] : 0 <= i0 <= 99 }
82; MEMORY-NEXT:      WAR dependences:
83; MEMORY-NEXT:          {  }
84; MEMORY-NEXT:      WAW dependences:
85; MEMORY-NEXT:          { Stmt_S1[i0] -> Stmt_S2[i0] : 0 <= i0 <= 9 }
86;
87; MEMORY-LABEL: Printing analysis 'Polly - Calculate dependences' for region: 'S1 => exit.3' in function 'write_after_read':
88; MEMORY-NEXT:      RAW dependences:
89; MEMORY-NEXT:          {  }
90; MEMORY-NEXT:      WAR dependences:
91; MEMORY-NEXT:          { Stmt_S1[i0] -> Stmt_S2[i0] : 0 <= i0 <= 9; Stmt_S1[i0] -> Stmt_S3[i0] : 0 <= i0 <= 99 }
92; MEMORY-NEXT:      WAW dependences:
93; MEMORY-NEXT:          { Stmt_S2[i0] -> Stmt_S3[i0] : 0 <= i0 <= 9 }
94;
95; MEMORY-LABEL: Printing analysis 'Polly - Calculate dependences' for region: 'S1 => exit.2' in function 'parametric_offset':
96; MEMORY-NEXT:      RAW dependences:
97; MEMORY-NEXT:          [p] -> { Stmt_S1[i0] -> Stmt_S2[-p + i0] : i0 >= p and 0 <= i0 <= 99 and i0 <= 9 + p }
98; MEMORY-NEXT:      WAR dependences:
99; MEMORY-NEXT:          [p] -> {  }
100; MEMORY-NEXT:      WAW dependences:
101; MEMORY-NEXT:          [p] -> {  }
102
103target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
104
105;     for(i = 0; i < 100; i++ )
106; S1:   A[i] = 2;
107;
108;     for (i = 0; i < 10; i++ )
109; S2:   A[i]  = 5;
110;
111;     for (i = 0; i < 200; i++ )
112; S3:   A[i] = 5;
113
114define void @sequential_writes() {
115entry:
116  %A = alloca [200 x i32]
117  br label %S1
118
119S1:
120  %indvar.1 = phi i64 [ 0, %entry ], [ %indvar.next.1, %S1 ]
121  %arrayidx.1 = getelementptr [200 x i32], [200 x i32]* %A, i64 0, i64 %indvar.1
122  store i32 2, i32* %arrayidx.1
123  %indvar.next.1 = add i64 %indvar.1, 1
124  %exitcond.1 = icmp ne i64 %indvar.next.1, 100
125  br i1 %exitcond.1, label %S1, label %exit.1
126
127exit.1:
128  br label %S2
129
130S2:
131  %indvar.2 = phi i64 [ 0, %exit.1 ], [ %indvar.next.2, %S2 ]
132  %arrayidx.2 = getelementptr [200 x i32], [200 x i32]* %A, i64 0, i64 %indvar.2
133  store i32 5, i32* %arrayidx.2
134  %indvar.next.2 = add i64 %indvar.2, 1
135  %exitcond.2 = icmp ne i64 %indvar.next.2, 10
136  br i1 %exitcond.2, label %S2, label %exit.2
137
138exit.2:
139  br label %S3
140
141S3:
142  %indvar.3 = phi i64 [ 0, %exit.2 ], [ %indvar.next.3, %S3 ]
143  %arrayidx.3 = getelementptr [200 x i32], [200 x i32]* %A, i64 0, i64 %indvar.3
144  store i32 7, i32* %arrayidx.3
145  %indvar.next.3 = add i64 %indvar.3, 1
146  %exitcond.3 = icmp ne i64 %indvar.next.3, 200
147  br i1 %exitcond.3, label %S3 , label %exit.3
148
149exit.3:
150  ret void
151}
152
153
154;     for(i = 0; i < 100; i++ )
155; S1:   A[i] = 2;
156;
157;     for (i = 0; i < 10; i++ )
158; S2:   A[i]  = 5;
159;
160;     for (i = 0; i < 200; i++ )
161; S3:   B[i] = A[i];
162
163define void @read_after_writes() {
164entry:
165  %A = alloca [200 x i32]
166  %B = alloca [200 x i32]
167  br label %S1
168
169S1:
170  %indvar.1 = phi i64 [ 0, %entry ], [ %indvar.next.1, %S1 ]
171  %arrayidx.1 = getelementptr [200 x i32], [200 x i32]* %A, i64 0, i64 %indvar.1
172  store i32 2, i32* %arrayidx.1
173  %indvar.next.1 = add i64 %indvar.1, 1
174  %exitcond.1 = icmp ne i64 %indvar.next.1, 100
175  br i1 %exitcond.1, label %S1, label %exit.1
176
177exit.1:
178  br label %S2
179
180S2:
181  %indvar.2 = phi i64 [ 0, %exit.1 ], [ %indvar.next.2, %S2 ]
182  %arrayidx.2 = getelementptr [200 x i32], [200 x i32]* %A, i64 0, i64 %indvar.2
183  store i32 5, i32* %arrayidx.2
184  %indvar.next.2 = add i64 %indvar.2, 1
185  %exitcond.2 = icmp ne i64 %indvar.next.2, 10
186  br i1 %exitcond.2, label %S2, label %exit.2
187
188exit.2:
189  br label %S3
190
191S3:
192  %indvar.3 = phi i64 [ 0, %exit.2 ], [ %indvar.next.3, %S3 ]
193  %arrayidx.3.a = getelementptr [200 x i32], [200 x i32]* %A, i64 0, i64 %indvar.3
194  %arrayidx.3.b = getelementptr [200 x i32], [200 x i32]* %B, i64 0, i64 %indvar.3
195  %val = load i32, i32* %arrayidx.3.a
196  store i32 %val, i32* %arrayidx.3.b
197  %indvar.next.3 = add i64 %indvar.3, 1
198  %exitcond.3 = icmp ne i64 %indvar.next.3, 200
199  br i1 %exitcond.3, label %S3 , label %exit.3
200
201exit.3:
202  ret void
203}
204
205
206;     for(i = 0; i < 100; i++ )
207; S1:   B[i] = A[i];
208;
209;     for (i = 0; i < 10; i++ )
210; S2:   A[i]  = 5;
211;
212;     for (i = 0; i < 200; i++ )
213; S3:   A[i]  = 10;
214
215define void @write_after_read() {
216entry:
217  %A = alloca [200 x i32]
218  %B = alloca [200 x i32]
219  br label %S1
220
221S1:
222  %indvar.1 = phi i64 [ 0, %entry ], [ %indvar.next.1, %S1 ]
223  %arrayidx.1.a = getelementptr [200 x i32], [200 x i32]* %A, i64 0, i64 %indvar.1
224  %arrayidx.1.b = getelementptr [200 x i32], [200 x i32]* %B, i64 0, i64 %indvar.1
225  %val = load i32, i32* %arrayidx.1.a
226  store i32 %val, i32* %arrayidx.1.b
227  %indvar.next.1 = add i64 %indvar.1, 1
228  %exitcond.1 = icmp ne i64 %indvar.next.1, 100
229  br i1 %exitcond.1, label %S1, label %exit.1
230
231exit.1:
232  br label %S2
233
234S2:
235  %indvar.2 = phi i64 [ 0, %exit.1 ], [ %indvar.next.2, %S2 ]
236  %arrayidx.2 = getelementptr [200 x i32], [200 x i32]* %A, i64 0, i64 %indvar.2
237  store i32 5, i32* %arrayidx.2
238  %indvar.next.2 = add i64 %indvar.2, 1
239  %exitcond.2 = icmp ne i64 %indvar.next.2, 10
240  br i1 %exitcond.2, label %S2, label %exit.2
241
242exit.2:
243  br label %S3
244
245S3:
246  %indvar.3 = phi i64 [ 0, %exit.2 ], [ %indvar.next.3, %S3 ]
247  %arrayidx.3 = getelementptr [200 x i32], [200 x i32]* %A, i64 0, i64 %indvar.3
248  store i32 10, i32* %arrayidx.3
249  %indvar.next.3 = add i64 %indvar.3, 1
250  %exitcond.3 = icmp ne i64 %indvar.next.3, 200
251  br i1 %exitcond.3, label %S3 , label %exit.3
252
253exit.3:
254  ret void
255}
256
257
258;     for(i = 0; i < 100; i++ )
259; S1:   A[i] = 10
260;
261;     for(i = 0; i < 100; i++ )
262; S2:   B[i] = A[i + p];
263
264define void @parametric_offset(i64 %p) {
265entry:
266  %A = alloca [200 x i32]
267  %B = alloca [200 x i32]
268  br label %S1
269
270S1:
271  %indvar.1 = phi i64 [ 0, %entry ], [ %indvar.next.1, %S1 ]
272  %arrayidx.1 = getelementptr [200 x i32], [200 x i32]* %A, i64 0, i64 %indvar.1
273  store i32 10, i32* %arrayidx.1
274  %indvar.next.1 = add i64 %indvar.1, 1
275  %exitcond.1 = icmp ne i64 %indvar.next.1, 100
276  br i1 %exitcond.1, label %S1, label %exit.1
277
278exit.1:
279  br label %S2
280
281S2:
282  %indvar.2 = phi i64 [ 0, %exit.1 ], [ %indvar.next.2, %S2 ]
283  %sum = add i64 %indvar.2, %p
284  %arrayidx.2.a = getelementptr [200 x i32], [200 x i32]* %A, i64 0, i64 %sum
285  %arrayidx.2.b = getelementptr [200 x i32], [200 x i32]* %B, i64 0, i64 %indvar.2
286  %val = load i32, i32* %arrayidx.2.a
287  store i32 %val, i32* %arrayidx.2.b
288  %indvar.next.2 = add i64 %indvar.2, 1
289  %exitcond.2 = icmp ne i64 %indvar.next.2, 10
290  br i1 %exitcond.2, label %S2, label %exit.2
291
292exit.2:
293  ret void
294}
295
296