• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -analyze -basicaa -da | FileCheck %s
2
3; ModuleID = 'WeakCrossingSIV.bc'
4target 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-S128"
5target triple = "x86_64-apple-macosx10.6.0"
6
7
8;;  for (long unsigned i = 0; i < n; i++) {
9;;    A[1 + n*i] = i;
10;;    *B++ = A[1 - n*i];
11
12define void @weakcrossing0(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
13entry:
14  %cmp1 = icmp eq i64 %n, 0
15  br i1 %cmp1, label %for.end, label %for.body.preheader
16
17for.body.preheader:                               ; preds = %entry
18  br label %for.body
19
20; CHECK: da analyze - none!
21; CHECK: da analyze - flow [0|<]!
22; CHECK: da analyze - confused!
23; CHECK: da analyze - none!
24; CHECK: da analyze - confused!
25; CHECK: da analyze - none!
26
27for.body:                                         ; preds = %for.body.preheader, %for.body
28  %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
29  %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
30  %conv = trunc i64 %i.03 to i32
31  %mul = mul i64 %i.03, %n
32  %add = add i64 %mul, 1
33  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
34  store i32 %conv, i32* %arrayidx, align 4
35  %mul1 = mul i64 %i.03, %n
36  %sub = sub i64 1, %mul1
37  %arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %sub
38  %0 = load i32, i32* %arrayidx2, align 4
39  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
40  store i32 %0, i32* %B.addr.02, align 4
41  %inc = add i64 %i.03, 1
42  %exitcond = icmp ne i64 %inc, %n
43  br i1 %exitcond, label %for.body, label %for.end.loopexit
44
45for.end.loopexit:                                 ; preds = %for.body
46  br label %for.end
47
48for.end:                                          ; preds = %for.end.loopexit, %entry
49  ret void
50}
51
52
53;;  for (long unsigned i = 0; i < n; i++) {
54;;    A[n + i] = i;
55;;    *B++ = A[1 + n - i];
56
57define void @weakcrossing1(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
58entry:
59  %cmp1 = icmp eq i64 %n, 0
60  br i1 %cmp1, label %for.end, label %for.body.preheader
61
62; CHECK: da analyze - none!
63; CHECK: da analyze - flow [<>] splitable!
64; CHECK: da analyze - split level = 1, iteration = 0!
65; CHECK: da analyze - confused!
66; CHECK: da analyze - none!
67; CHECK: da analyze - confused!
68; CHECK: da analyze - none!
69
70for.body.preheader:                               ; preds = %entry
71  br label %for.body
72
73for.body:                                         ; preds = %for.body.preheader, %for.body
74  %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
75  %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
76  %conv = trunc i64 %i.03 to i32
77  %add = add i64 %i.03, %n
78  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
79  store i32 %conv, i32* %arrayidx, align 4
80  %add1 = add i64 %n, 1
81  %sub = sub i64 %add1, %i.03
82  %arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %sub
83  %0 = load i32, i32* %arrayidx2, align 4
84  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
85  store i32 %0, i32* %B.addr.02, align 4
86  %inc = add i64 %i.03, 1
87  %exitcond = icmp ne i64 %inc, %n
88  br i1 %exitcond, label %for.body, label %for.end.loopexit
89
90for.end.loopexit:                                 ; preds = %for.body
91  br label %for.end
92
93for.end:                                          ; preds = %for.end.loopexit, %entry
94  ret void
95}
96
97
98;;  for (long unsigned i = 0; i < 3; i++) {
99;;    A[i] = i;
100;;    *B++ = A[6 - i];
101
102define void @weakcrossing2(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
103entry:
104  br label %for.body
105
106; CHECK: da analyze - none!
107; CHECK: da analyze - none!
108; CHECK: da analyze - confused!
109; CHECK: da analyze - none!
110; CHECK: da analyze - confused!
111; CHECK: da analyze - none!
112
113for.body:                                         ; preds = %entry, %for.body
114  %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
115  %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
116  %conv = trunc i64 %i.02 to i32
117  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %i.02
118  store i32 %conv, i32* %arrayidx, align 4
119  %sub = sub i64 6, %i.02
120  %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %sub
121  %0 = load i32, i32* %arrayidx1, align 4
122  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
123  store i32 %0, i32* %B.addr.01, align 4
124  %inc = add i64 %i.02, 1
125  %exitcond = icmp ne i64 %inc, 3
126  br i1 %exitcond, label %for.body, label %for.end
127
128for.end:                                          ; preds = %for.body
129  ret void
130}
131
132
133;;  for (long unsigned i = 0; i < 4; i++) {
134;;    A[i] = i;
135;;    *B++ = A[6 - i];
136
137define void @weakcrossing3(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
138entry:
139  br label %for.body
140
141; CHECK: da analyze - none!
142; CHECK: da analyze - flow [0|<]!
143; CHECK: da analyze - confused!
144; CHECK: da analyze - none!
145; CHECK: da analyze - confused!
146; CHECK: da analyze - none!
147
148for.body:                                         ; preds = %entry, %for.body
149  %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
150  %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
151  %conv = trunc i64 %i.02 to i32
152  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %i.02
153  store i32 %conv, i32* %arrayidx, align 4
154  %sub = sub i64 6, %i.02
155  %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %sub
156  %0 = load i32, i32* %arrayidx1, align 4
157  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
158  store i32 %0, i32* %B.addr.01, align 4
159  %inc = add i64 %i.02, 1
160  %exitcond = icmp ne i64 %inc, 4
161  br i1 %exitcond, label %for.body, label %for.end
162
163for.end:                                          ; preds = %for.body
164  ret void
165}
166
167
168;;  for (long unsigned i = 0; i < 10; i++) {
169;;    A[i] = i;
170;;    *B++ = A[-6 - i];
171
172define void @weakcrossing4(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
173entry:
174  br label %for.body
175
176; CHECK: da analyze - none!
177; CHECK: da analyze - none!
178; CHECK: da analyze - confused!
179; CHECK: da analyze - none!
180; CHECK: da analyze - confused!
181; CHECK: da analyze - none!
182
183for.body:                                         ; preds = %entry, %for.body
184  %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
185  %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
186  %conv = trunc i64 %i.02 to i32
187  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %i.02
188  store i32 %conv, i32* %arrayidx, align 4
189  %sub = sub i64 -6, %i.02
190  %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %sub
191  %0 = load i32, i32* %arrayidx1, align 4
192  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
193  store i32 %0, i32* %B.addr.01, align 4
194  %inc = add i64 %i.02, 1
195  %exitcond = icmp ne i64 %inc, 10
196  br i1 %exitcond, label %for.body, label %for.end
197
198for.end:                                          ; preds = %for.body
199  ret void
200}
201
202
203;;  for (long unsigned i = 0; i < n; i++) {
204;;    A[3*i] = i;
205;;    *B++ = A[5 - 3*i];
206
207define void @weakcrossing5(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
208entry:
209  %cmp1 = icmp eq i64 %n, 0
210  br i1 %cmp1, label %for.end, label %for.body.preheader
211
212; CHECK: da analyze - none!
213; CHECK: da analyze - none!
214; CHECK: da analyze - confused!
215; CHECK: da analyze - none!
216; CHECK: da analyze - confused!
217; CHECK: da analyze - none!
218
219for.body.preheader:                               ; preds = %entry
220  br label %for.body
221
222for.body:                                         ; preds = %for.body.preheader, %for.body
223  %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
224  %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
225  %conv = trunc i64 %i.03 to i32
226  %mul = mul i64 %i.03, 3
227  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %mul
228  store i32 %conv, i32* %arrayidx, align 4
229  %0 = mul i64 %i.03, -3
230  %sub = add i64 %0, 5
231  %arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %sub
232  %1 = load i32, i32* %arrayidx2, align 4
233  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
234  store i32 %1, i32* %B.addr.02, align 4
235  %inc = add i64 %i.03, 1
236  %exitcond = icmp ne i64 %inc, %n
237  br i1 %exitcond, label %for.body, label %for.end.loopexit
238
239for.end.loopexit:                                 ; preds = %for.body
240  br label %for.end
241
242for.end:                                          ; preds = %for.end.loopexit, %entry
243  ret void
244}
245
246
247;;  for (long unsigned i = 0; i < 4; i++) {
248;;    A[i] = i;
249;;    *B++ = A[5 - i];
250
251define void @weakcrossing6(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
252entry:
253  br label %for.body
254
255; CHECK: da analyze - none!
256; CHECK: da analyze - flow [<>] splitable!
257; CHECK: da analyze - split level = 1, iteration = 2!
258; CHECK: da analyze - confused!
259; CHECK: da analyze - none!
260; CHECK: da analyze - confused!
261; CHECK: da analyze - none!
262
263for.body:                                         ; preds = %entry, %for.body
264  %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
265  %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
266  %conv = trunc i64 %i.02 to i32
267  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %i.02
268  store i32 %conv, i32* %arrayidx, align 4
269  %sub = sub i64 5, %i.02
270  %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %sub
271  %0 = load i32, i32* %arrayidx1, align 4
272  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
273  store i32 %0, i32* %B.addr.01, align 4
274  %inc = add i64 %i.02, 1
275  %exitcond = icmp ne i64 %inc, 4
276  br i1 %exitcond, label %for.body, label %for.end
277
278for.end:                                          ; preds = %for.body
279  ret void
280}
281