1 ; RUN: opt < %s -disable-output "-passes=print<da>" -aa-pipeline=basic-aa 2>&1 \
3 ; RUN: opt < %s -analyze -basicaa -da | FileCheck %s
5 ; ModuleID = 'WeakCrossingSIV.bc'
6 target 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"
7 target triple = "x86_64-apple-macosx10.6.0"
10 ;; for (long unsigned i = 0; i < n; i++) {
14 define void @weakcrossing0(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
16 %cmp1 = icmp eq i64 %n, 0
17 br i1 %cmp1, label %for.end, label %for.body.preheader
19 for.body.preheader: ; preds = %entry
22 ; CHECK: da analyze - none!
23 ; CHECK: da analyze - flow [0|<]!
24 ; CHECK: da analyze - confused!
25 ; CHECK: da analyze - none!
26 ; CHECK: da analyze - confused!
27 ; CHECK: da analyze - none!
29 for.body: ; preds = %for.body.preheader, %for.body
30 %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
31 %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
32 %conv = trunc i64 %i.03 to i32
33 %mul = mul i64 %i.03, %n
34 %add = add i64 %mul, 1
35 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
36 store i32 %conv, i32* %arrayidx, align 4
37 %mul1 = mul i64 %i.03, %n
38 %sub = sub i64 1, %mul1
39 %arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %sub
40 %0 = load i32, i32* %arrayidx2, align 4
41 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
42 store i32 %0, i32* %B.addr.02, align 4
43 %inc = add i64 %i.03, 1
44 %exitcond = icmp ne i64 %inc, %n
45 br i1 %exitcond, label %for.body, label %for.end.loopexit
47 for.end.loopexit: ; preds = %for.body
50 for.end: ; preds = %for.end.loopexit, %entry
55 ;; for (long unsigned i = 0; i < n; i++) {
57 ;; *B++ = A[1 + n - i];
59 define void @weakcrossing1(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
61 %cmp1 = icmp eq i64 %n, 0
62 br i1 %cmp1, label %for.end, label %for.body.preheader
64 ; CHECK: da analyze - none!
65 ; CHECK: da analyze - flow [<>] splitable!
66 ; CHECK: da analyze - split level = 1, iteration = 0!
67 ; CHECK: da analyze - confused!
68 ; CHECK: da analyze - none!
69 ; CHECK: da analyze - confused!
70 ; CHECK: da analyze - none!
72 for.body.preheader: ; preds = %entry
75 for.body: ; preds = %for.body.preheader, %for.body
76 %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
77 %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
78 %conv = trunc i64 %i.03 to i32
79 %add = add i64 %i.03, %n
80 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
81 store i32 %conv, i32* %arrayidx, align 4
83 %sub = sub i64 %add1, %i.03
84 %arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %sub
85 %0 = load i32, i32* %arrayidx2, align 4
86 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
87 store i32 %0, i32* %B.addr.02, align 4
88 %inc = add i64 %i.03, 1
89 %exitcond = icmp ne i64 %inc, %n
90 br i1 %exitcond, label %for.body, label %for.end.loopexit
92 for.end.loopexit: ; preds = %for.body
95 for.end: ; preds = %for.end.loopexit, %entry
100 ;; for (long unsigned i = 0; i < 3; i++) {
104 define void @weakcrossing2(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
108 ; CHECK: da analyze - none!
109 ; CHECK: da analyze - none!
110 ; CHECK: da analyze - confused!
111 ; CHECK: da analyze - none!
112 ; CHECK: da analyze - confused!
113 ; CHECK: da analyze - none!
115 for.body: ; preds = %entry, %for.body
116 %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
117 %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
118 %conv = trunc i64 %i.02 to i32
119 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %i.02
120 store i32 %conv, i32* %arrayidx, align 4
121 %sub = sub i64 6, %i.02
122 %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %sub
123 %0 = load i32, i32* %arrayidx1, align 4
124 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
125 store i32 %0, i32* %B.addr.01, align 4
126 %inc = add i64 %i.02, 1
127 %exitcond = icmp ne i64 %inc, 3
128 br i1 %exitcond, label %for.body, label %for.end
130 for.end: ; preds = %for.body
135 ;; for (long unsigned i = 0; i < 4; i++) {
139 define void @weakcrossing3(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
143 ; CHECK: da analyze - none!
144 ; CHECK: da analyze - flow [0|<]!
145 ; CHECK: da analyze - confused!
146 ; CHECK: da analyze - none!
147 ; CHECK: da analyze - confused!
148 ; CHECK: da analyze - none!
150 for.body: ; preds = %entry, %for.body
151 %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
152 %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
153 %conv = trunc i64 %i.02 to i32
154 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %i.02
155 store i32 %conv, i32* %arrayidx, align 4
156 %sub = sub i64 6, %i.02
157 %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %sub
158 %0 = load i32, i32* %arrayidx1, align 4
159 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
160 store i32 %0, i32* %B.addr.01, align 4
161 %inc = add i64 %i.02, 1
162 %exitcond = icmp ne i64 %inc, 4
163 br i1 %exitcond, label %for.body, label %for.end
165 for.end: ; preds = %for.body
170 ;; for (long unsigned i = 0; i < 10; i++) {
174 define void @weakcrossing4(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
178 ; CHECK: da analyze - none!
179 ; CHECK: da analyze - none!
180 ; CHECK: da analyze - confused!
181 ; CHECK: da analyze - none!
182 ; CHECK: da analyze - confused!
183 ; CHECK: da analyze - none!
185 for.body: ; preds = %entry, %for.body
186 %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
187 %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
188 %conv = trunc i64 %i.02 to i32
189 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %i.02
190 store i32 %conv, i32* %arrayidx, align 4
191 %sub = sub i64 -6, %i.02
192 %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %sub
193 %0 = load i32, i32* %arrayidx1, align 4
194 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
195 store i32 %0, i32* %B.addr.01, align 4
196 %inc = add i64 %i.02, 1
197 %exitcond = icmp ne i64 %inc, 10
198 br i1 %exitcond, label %for.body, label %for.end
200 for.end: ; preds = %for.body
205 ;; for (long unsigned i = 0; i < n; i++) {
207 ;; *B++ = A[5 - 3*i];
209 define void @weakcrossing5(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
211 %cmp1 = icmp eq i64 %n, 0
212 br i1 %cmp1, label %for.end, label %for.body.preheader
214 ; CHECK: da analyze - none!
215 ; CHECK: da analyze - none!
216 ; CHECK: da analyze - confused!
217 ; CHECK: da analyze - none!
218 ; CHECK: da analyze - confused!
219 ; CHECK: da analyze - none!
221 for.body.preheader: ; preds = %entry
224 for.body: ; preds = %for.body.preheader, %for.body
225 %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
226 %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
227 %conv = trunc i64 %i.03 to i32
228 %mul = mul i64 %i.03, 3
229 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %mul
230 store i32 %conv, i32* %arrayidx, align 4
231 %0 = mul i64 %i.03, -3
233 %arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %sub
234 %1 = load i32, i32* %arrayidx2, align 4
235 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
236 store i32 %1, i32* %B.addr.02, align 4
237 %inc = add i64 %i.03, 1
238 %exitcond = icmp ne i64 %inc, %n
239 br i1 %exitcond, label %for.body, label %for.end.loopexit
241 for.end.loopexit: ; preds = %for.body
244 for.end: ; preds = %for.end.loopexit, %entry
249 ;; for (long unsigned i = 0; i < 4; i++) {
253 define void @weakcrossing6(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
257 ; CHECK: da analyze - none!
258 ; CHECK: da analyze - flow [<>] splitable!
259 ; CHECK: da analyze - split level = 1, iteration = 2!
260 ; CHECK: da analyze - confused!
261 ; CHECK: da analyze - none!
262 ; CHECK: da analyze - confused!
263 ; CHECK: da analyze - none!
265 for.body: ; preds = %entry, %for.body
266 %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
267 %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
268 %conv = trunc i64 %i.02 to i32
269 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %i.02
270 store i32 %conv, i32* %arrayidx, align 4
271 %sub = sub i64 5, %i.02
272 %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %sub
273 %0 = load i32, i32* %arrayidx1, align 4
274 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
275 store i32 %0, i32* %B.addr.01, align 4
276 %inc = add i64 %i.02, 1
277 %exitcond = icmp ne i64 %inc, 4
278 br i1 %exitcond, label %for.body, label %for.end
280 for.end: ; preds = %for.body