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 = 'WeakZeroSrcSIV.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 (int i = 0; i < N; i++) {
14 define void @dstzero(i32* nocapture %A, i32 %N) {
16 %cmp6 = icmp sgt i32 %N, 0
17 br i1 %cmp6, label %for.body, label %for.cond.cleanup
19 ; CHECK: da analyze - consistent output [S]!
20 ; CHECK: da analyze - output [p=>|<]!
21 ; CHECK: da analyze - none!
23 for.body: ; preds = %entry, %for.body
24 %i.07 = phi i32 [ %add, %for.body ], [ 0, %entry ]
25 store i32 0, i32* %A, align 4
26 %arrayidx1 = getelementptr inbounds i32, i32* %A, i32 %i.07
27 store i32 1, i32* %arrayidx1, align 4
28 %add = add nuw nsw i32 %i.07, 1
29 %exitcond = icmp eq i32 %add, %N
30 br i1 %exitcond, label %for.cond.cleanup, label %for.body
32 for.cond.cleanup: ; preds = %for.body, %entry
37 ;; for (long unsigned i = 0; i < 30; i++) {
39 ;; *B++ = A[2*i + 10];
41 define void @weakzerosrc0(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
45 ; CHECK: da analyze - consistent output [S]!
46 ; CHECK: da analyze - flow [p=>|<]!
47 ; CHECK: da analyze - confused!
48 ; CHECK: da analyze - none!
49 ; CHECK: da analyze - confused!
50 ; CHECK: da analyze - none!
52 for.body: ; preds = %entry, %for.body
53 %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
54 %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
55 %conv = trunc i64 %i.02 to i32
56 %arrayidx = getelementptr inbounds i32, i32* %A, i64 10
57 store i32 %conv, i32* %arrayidx, align 4
58 %mul = shl i64 %i.02, 1
59 %add = add i64 %mul, 10
60 %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %add
61 %0 = load i32, i32* %arrayidx1, align 4
62 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
63 store i32 %0, i32* %B.addr.01, align 4
64 %inc = add i64 %i.02, 1
65 %exitcond = icmp ne i64 %inc, 30
66 br i1 %exitcond, label %for.body, label %for.end
68 for.end: ; preds = %for.body
73 ;; for (long unsigned i = 0; i < n; i++) {
75 ;; *B++ = A[n*i + 10];
77 define void @weakzerosrc1(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
79 %cmp1 = icmp eq i64 %n, 0
80 br i1 %cmp1, label %for.end, label %for.body.preheader
82 ; CHECK: da analyze - consistent output [S]!
83 ; CHECK: da analyze - flow [p=>|<]!
84 ; CHECK: da analyze - confused!
85 ; CHECK: da analyze - none!
86 ; CHECK: da analyze - confused!
87 ; CHECK: da analyze - none!
89 for.body.preheader: ; preds = %entry
92 for.body: ; preds = %for.body.preheader, %for.body
93 %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
94 %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
95 %conv = trunc i64 %i.03 to i32
96 %arrayidx = getelementptr inbounds i32, i32* %A, i64 10
97 store i32 %conv, i32* %arrayidx, align 4
98 %mul = mul i64 %i.03, %n
99 %add = add i64 %mul, 10
100 %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %add
101 %0 = load i32, i32* %arrayidx1, align 4
102 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
103 store i32 %0, i32* %B.addr.02, align 4
104 %inc = add i64 %i.03, 1
105 %exitcond = icmp ne i64 %inc, %n
106 br i1 %exitcond, label %for.body, label %for.end.loopexit
108 for.end.loopexit: ; preds = %for.body
111 for.end: ; preds = %for.end.loopexit, %entry
116 ;; for (long unsigned i = 0; i < 5; i++) {
120 define void @weakzerosrc2(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
124 ; CHECK: da analyze - consistent output [S]!
125 ; CHECK: da analyze - none!
126 ; CHECK: da analyze - confused!
127 ; CHECK: da analyze - none!
128 ; CHECK: da analyze - confused!
129 ; CHECK: da analyze - none!
131 for.body: ; preds = %entry, %for.body
132 %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
133 %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
134 %conv = trunc i64 %i.02 to i32
135 %arrayidx = getelementptr inbounds i32, i32* %A, i64 10
136 store i32 %conv, i32* %arrayidx, align 4
137 %mul = shl i64 %i.02, 1
138 %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %mul
139 %0 = load i32, i32* %arrayidx1, align 4
140 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
141 store i32 %0, i32* %B.addr.01, align 4
142 %inc = add i64 %i.02, 1
143 %exitcond = icmp ne i64 %inc, 5
144 br i1 %exitcond, label %for.body, label %for.end
146 for.end: ; preds = %for.body
151 ;; for (long unsigned i = 0; i < 6; i++) {
155 define void @weakzerosrc3(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
159 ; CHECK: da analyze - consistent output [S]!
160 ; CHECK: da analyze - flow [<=p|<]!
161 ; CHECK: da analyze - confused!
162 ; CHECK: da analyze - none!
163 ; CHECK: da analyze - confused!
164 ; CHECK: da analyze - none!
166 for.body: ; preds = %entry, %for.body
167 %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
168 %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
169 %conv = trunc i64 %i.02 to i32
170 %arrayidx = getelementptr inbounds i32, i32* %A, i64 10
171 store i32 %conv, i32* %arrayidx, align 4
172 %mul = shl i64 %i.02, 1
173 %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %mul
174 %0 = load i32, i32* %arrayidx1, align 4
175 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
176 store i32 %0, i32* %B.addr.01, align 4
177 %inc = add i64 %i.02, 1
178 %exitcond = icmp ne i64 %inc, 6
179 br i1 %exitcond, label %for.body, label %for.end
181 for.end: ; preds = %for.body
186 ;; for (long unsigned i = 0; i < 7; i++) {
190 define void @weakzerosrc4(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
194 ; CHECK: da analyze - consistent output [S]!
195 ; CHECK: da analyze - flow [*|<]!
196 ; CHECK: da analyze - confused!
197 ; CHECK: da analyze - none!
198 ; CHECK: da analyze - confused!
199 ; CHECK: da analyze - none!
201 for.body: ; preds = %entry, %for.body
202 %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
203 %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
204 %conv = trunc i64 %i.02 to i32
205 %arrayidx = getelementptr inbounds i32, i32* %A, i64 10
206 store i32 %conv, i32* %arrayidx, align 4
207 %mul = shl i64 %i.02, 1
208 %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %mul
209 %0 = load i32, i32* %arrayidx1, align 4
210 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
211 store i32 %0, i32* %B.addr.01, align 4
212 %inc = add i64 %i.02, 1
213 %exitcond = icmp ne i64 %inc, 7
214 br i1 %exitcond, label %for.body, label %for.end
216 for.end: ; preds = %for.body
221 ;; for (long unsigned i = 0; i < 7; i++) {
225 define void @weakzerosrc5(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
229 ; CHECK: da analyze - consistent output [S]!
230 ; CHECK: da analyze - none!
231 ; CHECK: da analyze - confused!
232 ; CHECK: da analyze - none!
233 ; CHECK: da analyze - confused!
234 ; CHECK: da analyze - none!
236 for.body: ; preds = %entry, %for.body
237 %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
238 %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
239 %conv = trunc i64 %i.02 to i32
240 %arrayidx = getelementptr inbounds i32, i32* %A, i64 -10
241 store i32 %conv, i32* %arrayidx, align 4
242 %mul = shl i64 %i.02, 1
243 %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %mul
244 %0 = load i32, i32* %arrayidx1, align 4
245 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
246 store i32 %0, i32* %B.addr.01, align 4
247 %inc = add i64 %i.02, 1
248 %exitcond = icmp ne i64 %inc, 7
249 br i1 %exitcond, label %for.body, label %for.end
251 for.end: ; preds = %for.body
256 ;; for (long unsigned i = 0; i < n; i++) {
260 define void @weakzerosrc6(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
262 %cmp1 = icmp eq i64 %n, 0
263 br i1 %cmp1, label %for.end, label %for.body.preheader
265 ; CHECK: da analyze - consistent output [S]!
266 ; CHECK: da analyze - none!
267 ; CHECK: da analyze - confused!
268 ; CHECK: da analyze - none!
269 ; CHECK: da analyze - confused!
270 ; CHECK: da analyze - none!
272 for.body.preheader: ; preds = %entry
275 for.body: ; preds = %for.body.preheader, %for.body
276 %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
277 %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
278 %conv = trunc i64 %i.03 to i32
279 %arrayidx = getelementptr inbounds i32, i32* %A, i64 10
280 store i32 %conv, i32* %arrayidx, align 4
281 %mul = mul i64 %i.03, 3
282 %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %mul
283 %0 = load i32, i32* %arrayidx1, align 4
284 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
285 store i32 %0, i32* %B.addr.02, align 4
286 %inc = add i64 %i.03, 1
287 %exitcond = icmp ne i64 %inc, %n
288 br i1 %exitcond, label %for.body, label %for.end.loopexit
290 for.end.loopexit: ; preds = %for.body
293 for.end: ; preds = %for.end.loopexit, %entry