1 ; RUN: opt < %s -analyze -basicaa -da | FileCheck %s
3 ; ModuleID = 'WeakZeroSrcSIV.bc'
4 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"
5 target triple = "x86_64-apple-macosx10.6.0"
8 ;; for (long unsigned i = 0; i < 30; i++) {
10 ;; *B++ = A[2*i + 10];
12 define void @weakzerosrc0(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
16 ; CHECK: da analyze - consistent output [S]!
17 ; CHECK: da analyze - flow [p<=|<]!
18 ; CHECK: da analyze - confused!
19 ; CHECK: da analyze - none!
20 ; CHECK: da analyze - confused!
21 ; CHECK: da analyze - none!
23 for.body: ; preds = %entry, %for.body
24 %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
25 %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
26 %conv = trunc i64 %i.02 to i32
27 %arrayidx = getelementptr inbounds i32, i32* %A, i64 10
28 store i32 %conv, i32* %arrayidx, align 4
29 %mul = shl i64 %i.02, 1
30 %add = add i64 %mul, 10
31 %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %add
32 %0 = load i32, i32* %arrayidx1, align 4
33 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
34 store i32 %0, i32* %B.addr.01, align 4
35 %inc = add i64 %i.02, 1
36 %exitcond = icmp ne i64 %inc, 30
37 br i1 %exitcond, label %for.body, label %for.end
39 for.end: ; preds = %for.body
44 ;; for (long unsigned i = 0; i < n; i++) {
46 ;; *B++ = A[n*i + 10];
48 define void @weakzerosrc1(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
50 %cmp1 = icmp eq i64 %n, 0
51 br i1 %cmp1, label %for.end, label %for.body.preheader
53 ; CHECK: da analyze - consistent output [S]!
54 ; CHECK: da analyze - flow [p<=|<]!
55 ; CHECK: da analyze - confused!
56 ; CHECK: da analyze - none!
57 ; CHECK: da analyze - confused!
58 ; CHECK: da analyze - none!
60 for.body.preheader: ; preds = %entry
63 for.body: ; preds = %for.body.preheader, %for.body
64 %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
65 %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
66 %conv = trunc i64 %i.03 to i32
67 %arrayidx = getelementptr inbounds i32, i32* %A, i64 10
68 store i32 %conv, i32* %arrayidx, align 4
69 %mul = mul i64 %i.03, %n
70 %add = add i64 %mul, 10
71 %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %add
72 %0 = load i32, i32* %arrayidx1, align 4
73 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
74 store i32 %0, i32* %B.addr.02, align 4
75 %inc = add i64 %i.03, 1
76 %exitcond = icmp ne i64 %inc, %n
77 br i1 %exitcond, label %for.body, label %for.end.loopexit
79 for.end.loopexit: ; preds = %for.body
82 for.end: ; preds = %for.end.loopexit, %entry
87 ;; for (long unsigned i = 0; i < 5; i++) {
91 define void @weakzerosrc2(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
95 ; CHECK: da analyze - consistent output [S]!
96 ; CHECK: da analyze - none!
97 ; CHECK: da analyze - confused!
98 ; CHECK: da analyze - none!
99 ; CHECK: da analyze - confused!
100 ; CHECK: da analyze - none!
102 for.body: ; preds = %entry, %for.body
103 %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
104 %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
105 %conv = trunc i64 %i.02 to i32
106 %arrayidx = getelementptr inbounds i32, i32* %A, i64 10
107 store i32 %conv, i32* %arrayidx, align 4
108 %mul = shl i64 %i.02, 1
109 %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %mul
110 %0 = load i32, i32* %arrayidx1, align 4
111 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
112 store i32 %0, i32* %B.addr.01, align 4
113 %inc = add i64 %i.02, 1
114 %exitcond = icmp ne i64 %inc, 5
115 br i1 %exitcond, label %for.body, label %for.end
117 for.end: ; preds = %for.body
122 ;; for (long unsigned i = 0; i < 6; i++) {
126 define void @weakzerosrc3(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
130 ; CHECK: da analyze - consistent output [S]!
131 ; CHECK: da analyze - flow [=>p|<]!
132 ; CHECK: da analyze - confused!
133 ; CHECK: da analyze - none!
134 ; CHECK: da analyze - confused!
135 ; CHECK: da analyze - none!
137 for.body: ; preds = %entry, %for.body
138 %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
139 %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
140 %conv = trunc i64 %i.02 to i32
141 %arrayidx = getelementptr inbounds i32, i32* %A, i64 10
142 store i32 %conv, i32* %arrayidx, align 4
143 %mul = shl i64 %i.02, 1
144 %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %mul
145 %0 = load i32, i32* %arrayidx1, align 4
146 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
147 store i32 %0, i32* %B.addr.01, align 4
148 %inc = add i64 %i.02, 1
149 %exitcond = icmp ne i64 %inc, 6
150 br i1 %exitcond, label %for.body, label %for.end
152 for.end: ; preds = %for.body
157 ;; for (long unsigned i = 0; i < 7; i++) {
161 define void @weakzerosrc4(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
165 ; CHECK: da analyze - consistent output [S]!
166 ; CHECK: da analyze - flow [*|<]!
167 ; CHECK: da analyze - confused!
168 ; CHECK: da analyze - none!
169 ; CHECK: da analyze - confused!
170 ; CHECK: da analyze - none!
172 for.body: ; preds = %entry, %for.body
173 %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
174 %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
175 %conv = trunc i64 %i.02 to i32
176 %arrayidx = getelementptr inbounds i32, i32* %A, i64 10
177 store i32 %conv, i32* %arrayidx, align 4
178 %mul = shl i64 %i.02, 1
179 %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %mul
180 %0 = load i32, i32* %arrayidx1, align 4
181 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
182 store i32 %0, i32* %B.addr.01, align 4
183 %inc = add i64 %i.02, 1
184 %exitcond = icmp ne i64 %inc, 7
185 br i1 %exitcond, label %for.body, label %for.end
187 for.end: ; preds = %for.body
192 ;; for (long unsigned i = 0; i < 7; i++) {
196 define void @weakzerosrc5(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
200 ; CHECK: da analyze - consistent output [S]!
201 ; CHECK: da analyze - none!
202 ; CHECK: da analyze - confused!
203 ; CHECK: da analyze - none!
204 ; CHECK: da analyze - confused!
205 ; CHECK: da analyze - none!
207 for.body: ; preds = %entry, %for.body
208 %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
209 %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
210 %conv = trunc i64 %i.02 to i32
211 %arrayidx = getelementptr inbounds i32, i32* %A, i64 -10
212 store i32 %conv, i32* %arrayidx, align 4
213 %mul = shl i64 %i.02, 1
214 %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %mul
215 %0 = load i32, i32* %arrayidx1, align 4
216 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
217 store i32 %0, i32* %B.addr.01, align 4
218 %inc = add i64 %i.02, 1
219 %exitcond = icmp ne i64 %inc, 7
220 br i1 %exitcond, label %for.body, label %for.end
222 for.end: ; preds = %for.body
227 ;; for (long unsigned i = 0; i < n; i++) {
231 define void @weakzerosrc6(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
233 %cmp1 = icmp eq i64 %n, 0
234 br i1 %cmp1, label %for.end, label %for.body.preheader
236 ; CHECK: da analyze - consistent output [S]!
237 ; CHECK: da analyze - none!
238 ; CHECK: da analyze - confused!
239 ; CHECK: da analyze - none!
240 ; CHECK: da analyze - confused!
241 ; CHECK: da analyze - none!
243 for.body.preheader: ; preds = %entry
246 for.body: ; preds = %for.body.preheader, %for.body
247 %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
248 %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
249 %conv = trunc i64 %i.03 to i32
250 %arrayidx = getelementptr inbounds i32, i32* %A, i64 10
251 store i32 %conv, i32* %arrayidx, align 4
252 %mul = mul i64 %i.03, 3
253 %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %mul
254 %0 = load i32, i32* %arrayidx1, align 4
255 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
256 store i32 %0, i32* %B.addr.02, align 4
257 %inc = add i64 %i.03, 1
258 %exitcond = icmp ne i64 %inc, %n
259 br i1 %exitcond, label %for.body, label %for.end.loopexit
261 for.end.loopexit: ; preds = %for.body
264 for.end: ; preds = %for.end.loopexit, %entry