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 = 'WeakZeroDstSIV.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 - none!
20 ; CHECK: da analyze - output [p<=|<]!
21 ; CHECK: da analyze - consistent output [S]!
23 for.body: ; preds = %entry, %for.body
24 %i.07 = phi i32 [ %add, %for.body ], [ 0, %entry ]
25 %arrayidx = getelementptr inbounds i32, i32* %A, i32 %i.07
26 store i32 0, i32* %arrayidx, align 4
27 store i32 1, i32* %A, 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
39 ;; for (long unsigned i = 0; i < 30; i++) {
43 define void @weakzerodst0(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
47 ; CHECK: da analyze - none!
48 ; CHECK: da analyze - flow [p<=|<]!
49 ; CHECK: da analyze - confused!
50 ; CHECK: da analyze - consistent input [S]!
51 ; CHECK: da analyze - confused!
52 ; CHECK: da analyze - none!
54 for.body: ; preds = %entry, %for.body
55 %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
56 %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
57 %conv = trunc i64 %i.02 to i32
58 %mul = shl i64 %i.02, 1
59 %add = add i64 %mul, 10
60 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
61 store i32 %conv, i32* %arrayidx, align 4
62 %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 10
63 %0 = load i32, i32* %arrayidx1, align 4
64 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
65 store i32 %0, i32* %B.addr.01, align 4
66 %inc = add i64 %i.02, 1
67 %exitcond = icmp ne i64 %inc, 30
68 br i1 %exitcond, label %for.body, label %for.end
70 for.end: ; preds = %for.body
75 ;; for (long unsigned i = 0; i < n; i++) {
79 define void @weakzerodst1(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
81 %cmp1 = icmp eq i64 %n, 0
82 br i1 %cmp1, label %for.end, label %for.body.preheader
84 ; CHECK: da analyze - none!
85 ; CHECK: da analyze - flow [p<=|<]!
86 ; CHECK: da analyze - confused!
87 ; CHECK: da analyze - consistent input [S]!
88 ; CHECK: da analyze - confused!
89 ; CHECK: da analyze - none!
91 for.body.preheader: ; preds = %entry
94 for.body: ; preds = %for.body.preheader, %for.body
95 %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
96 %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
97 %conv = trunc i64 %i.03 to i32
98 %mul = mul i64 %i.03, %n
99 %add = add i64 %mul, 10
100 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
101 store i32 %conv, i32* %arrayidx, align 4
102 %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 10
103 %0 = load i32, i32* %arrayidx1, align 4
104 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
105 store i32 %0, i32* %B.addr.02, align 4
106 %inc = add i64 %i.03, 1
107 %exitcond = icmp ne i64 %inc, %n
108 br i1 %exitcond, label %for.body, label %for.end.loopexit
110 for.end.loopexit: ; preds = %for.body
113 for.end: ; preds = %for.end.loopexit, %entry
118 ;; for (long unsigned i = 0; i < 5; i++) {
122 define void @weakzerodst2(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
126 ; CHECK: da analyze - none!
127 ; CHECK: da analyze - none!
128 ; CHECK: da analyze - confused!
129 ; CHECK: da analyze - consistent input [S]!
130 ; CHECK: da analyze - confused!
131 ; CHECK: da analyze - none!
133 for.body: ; preds = %entry, %for.body
134 %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
135 %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
136 %conv = trunc i64 %i.02 to i32
137 %mul = shl i64 %i.02, 1
138 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %mul
139 store i32 %conv, i32* %arrayidx, align 4
140 %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 10
141 %0 = load i32, i32* %arrayidx1, align 4
142 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
143 store i32 %0, i32* %B.addr.01, align 4
144 %inc = add i64 %i.02, 1
145 %exitcond = icmp ne i64 %inc, 5
146 br i1 %exitcond, label %for.body, label %for.end
148 for.end: ; preds = %for.body
153 ;; for (long unsigned i = 0; i < 6; i++) {
157 define void @weakzerodst3(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
161 ; CHECK: da analyze - none!
162 ; CHECK: da analyze - flow [=>p|<]!
163 ; CHECK: da analyze - confused!
164 ; CHECK: da analyze - consistent input [S]!
165 ; CHECK: da analyze - confused!
166 ; CHECK: da analyze - none!
168 for.body: ; preds = %entry, %for.body
169 %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
170 %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
171 %conv = trunc i64 %i.02 to i32
172 %mul = shl i64 %i.02, 1
173 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %mul
174 store i32 %conv, i32* %arrayidx, align 4
175 %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 10
176 %0 = load i32, i32* %arrayidx1, align 4
177 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
178 store i32 %0, i32* %B.addr.01, align 4
179 %inc = add i64 %i.02, 1
180 %exitcond = icmp ne i64 %inc, 6
181 br i1 %exitcond, label %for.body, label %for.end
183 for.end: ; preds = %for.body
188 ;; for (long unsigned i = 0; i < 7; i++) {
192 define void @weakzerodst4(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
196 ; CHECK: da analyze - none!
197 ; CHECK: da analyze - flow [*|<]!
198 ; CHECK: da analyze - confused!
199 ; CHECK: da analyze - consistent input [S]!
200 ; CHECK: da analyze - confused!
201 ; CHECK: da analyze - none!
203 for.body: ; preds = %entry, %for.body
204 %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
205 %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
206 %conv = trunc i64 %i.02 to i32
207 %mul = shl i64 %i.02, 1
208 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %mul
209 store i32 %conv, i32* %arrayidx, align 4
210 %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 10
211 %0 = load i32, i32* %arrayidx1, align 4
212 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
213 store i32 %0, i32* %B.addr.01, align 4
214 %inc = add i64 %i.02, 1
215 %exitcond = icmp ne i64 %inc, 7
216 br i1 %exitcond, label %for.body, label %for.end
218 for.end: ; preds = %for.body
223 ;; for (long unsigned i = 0; i < 7; i++) {
227 define void @weakzerodst5(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
231 ; CHECK: da analyze - none!
232 ; CHECK: da analyze - none!
233 ; CHECK: da analyze - confused!
234 ; CHECK: da analyze - consistent input [S]!
235 ; CHECK: da analyze - confused!
236 ; CHECK: da analyze - none!
238 for.body: ; preds = %entry, %for.body
239 %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
240 %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
241 %conv = trunc i64 %i.02 to i32
242 %mul = shl i64 %i.02, 1
243 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %mul
244 store i32 %conv, i32* %arrayidx, align 4
245 %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 -10
246 %0 = load i32, i32* %arrayidx1, align 4
247 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
248 store i32 %0, i32* %B.addr.01, align 4
249 %inc = add i64 %i.02, 1
250 %exitcond = icmp ne i64 %inc, 7
251 br i1 %exitcond, label %for.body, label %for.end
253 for.end: ; preds = %for.body
258 ;; for (long unsigned i = 0; i < n; i++) {
262 define void @weakzerodst6(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
264 %cmp1 = icmp eq i64 %n, 0
265 br i1 %cmp1, label %for.end, label %for.body.preheader
267 ; CHECK: da analyze - none!
268 ; CHECK: da analyze - none!
269 ; CHECK: da analyze - confused!
270 ; CHECK: da analyze - consistent input [S]!
271 ; CHECK: da analyze - confused!
272 ; CHECK: da analyze - none!
274 for.body.preheader: ; preds = %entry
277 for.body: ; preds = %for.body.preheader, %for.body
278 %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
279 %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
280 %conv = trunc i64 %i.03 to i32
281 %mul = mul i64 %i.03, 3
282 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %mul
283 store i32 %conv, i32* %arrayidx, align 4
284 %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 10
285 %0 = load i32, i32* %arrayidx1, align 4
286 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
287 store i32 %0, i32* %B.addr.02, align 4
288 %inc = add i64 %i.03, 1
289 %exitcond = icmp ne i64 %inc, %n
290 br i1 %exitcond, label %for.body, label %for.end.loopexit
292 for.end.loopexit: ; preds = %for.body
295 for.end: ; preds = %for.end.loopexit, %entry