• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -analyze -basicaa -da | FileCheck %s
2
3; ModuleID = 'Preliminary.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;;int p0(int n, int *A, int *B) {
9;;  A[0] = n;
10;;  return B[1];
11
12define i32 @p0(i32 %n, i32* %A, i32* %B) nounwind uwtable ssp {
13entry:
14  store i32 %n, i32* %A, align 4
15
16; CHECK: da analyze - none!
17; CHECK: da analyze - confused!
18; CHECK: da analyze - none!
19
20  %arrayidx1 = getelementptr inbounds i32, i32* %B, i64 1
21  %0 = load i32, i32* %arrayidx1, align 4
22  ret i32 %0
23}
24
25
26;;int p1(int n, int *restrict A, int *restrict B) {
27;;  A[0] = n;
28;;  return B[1];
29
30define i32 @p1(i32 %n, i32* noalias %A, i32* noalias %B) nounwind uwtable ssp {
31entry:
32  store i32 %n, i32* %A, align 4
33
34; CHECK: da analyze - none!
35; CHECK: da analyze - none!
36; CHECK: da analyze - none!
37
38  %arrayidx1 = getelementptr inbounds i32, i32* %B, i64 1
39  %0 = load i32, i32* %arrayidx1, align 4
40  ret i32 %0
41}
42
43
44;;  for (long int i = 0; i < n; i++) {
45;;    for (long int j = 0; j < n; j++) {
46;;      for (long int k = 0; k < n; k++) {
47;;        A[i][j][k] = i;
48;;      }
49;;      for (long int k = 0; k < n; k++) {
50;;        *B++ = A[i + 3][j + 2][k + 1];
51
52define void @p2(i64 %n, [100 x [100 x i64]]* %A, i64* %B) nounwind uwtable ssp {
53entry:
54  %cmp10 = icmp sgt i64 %n, 0
55  br i1 %cmp10, label %for.cond1.preheader.preheader, label %for.end26
56
57; CHECK: da analyze - none!
58; CHECK: da analyze - flow [-3 -2]!
59; CHECK: da analyze - confused!
60; CHECK: da analyze - none!
61; CHECK: da analyze - confused!
62; CHECK: da analyze - output [* * *]!
63
64for.cond1.preheader.preheader:                    ; preds = %entry
65  br label %for.cond1.preheader
66
67for.cond1.preheader:                              ; preds = %for.cond1.preheader.preheader, %for.inc24
68  %B.addr.012 = phi i64* [ %B.addr.1.lcssa, %for.inc24 ], [ %B, %for.cond1.preheader.preheader ]
69  %i.011 = phi i64 [ %inc25, %for.inc24 ], [ 0, %for.cond1.preheader.preheader ]
70  %cmp26 = icmp sgt i64 %n, 0
71  br i1 %cmp26, label %for.cond4.preheader.preheader, label %for.inc24
72
73for.cond4.preheader.preheader:                    ; preds = %for.cond1.preheader
74  br label %for.cond4.preheader
75
76for.cond4.preheader:                              ; preds = %for.cond4.preheader.preheader, %for.inc21
77  %B.addr.18 = phi i64* [ %B.addr.2.lcssa, %for.inc21 ], [ %B.addr.012, %for.cond4.preheader.preheader ]
78  %j.07 = phi i64 [ %inc22, %for.inc21 ], [ 0, %for.cond4.preheader.preheader ]
79  %cmp51 = icmp sgt i64 %n, 0
80  br i1 %cmp51, label %for.body6.preheader, label %for.cond10.loopexit
81
82for.body6.preheader:                              ; preds = %for.cond4.preheader
83  br label %for.body6
84
85for.body6:                                        ; preds = %for.body6.preheader, %for.body6
86  %k.02 = phi i64 [ %inc, %for.body6 ], [ 0, %for.body6.preheader ]
87  %arrayidx8 = getelementptr inbounds [100 x [100 x i64]], [100 x [100 x i64]]* %A, i64 %i.011, i64 %j.07, i64 %k.02
88  store i64 %i.011, i64* %arrayidx8, align 8
89  %inc = add nsw i64 %k.02, 1
90  %exitcond13 = icmp ne i64 %inc, %n
91  br i1 %exitcond13, label %for.body6, label %for.cond10.loopexit.loopexit
92
93for.cond10.loopexit.loopexit:                     ; preds = %for.body6
94  br label %for.cond10.loopexit
95
96for.cond10.loopexit:                              ; preds = %for.cond10.loopexit.loopexit, %for.cond4.preheader
97  %cmp113 = icmp sgt i64 %n, 0
98  br i1 %cmp113, label %for.body12.preheader, label %for.inc21
99
100for.body12.preheader:                             ; preds = %for.cond10.loopexit
101  br label %for.body12
102
103for.body12:                                       ; preds = %for.body12.preheader, %for.body12
104  %k9.05 = phi i64 [ %inc19, %for.body12 ], [ 0, %for.body12.preheader ]
105  %B.addr.24 = phi i64* [ %incdec.ptr, %for.body12 ], [ %B.addr.18, %for.body12.preheader ]
106  %add = add nsw i64 %k9.05, 1
107  %add13 = add nsw i64 %j.07, 2
108  %add14 = add nsw i64 %i.011, 3
109  %arrayidx17 = getelementptr inbounds [100 x [100 x i64]], [100 x [100 x i64]]* %A, i64 %add14, i64 %add13, i64 %add
110  %0 = load i64, i64* %arrayidx17, align 8
111  %incdec.ptr = getelementptr inbounds i64, i64* %B.addr.24, i64 1
112  store i64 %0, i64* %B.addr.24, align 8
113  %inc19 = add nsw i64 %k9.05, 1
114  %exitcond = icmp ne i64 %inc19, %n
115  br i1 %exitcond, label %for.body12, label %for.inc21.loopexit
116
117for.inc21.loopexit:                               ; preds = %for.body12
118  %scevgep = getelementptr i64, i64* %B.addr.18, i64 %n
119  br label %for.inc21
120
121for.inc21:                                        ; preds = %for.inc21.loopexit, %for.cond10.loopexit
122  %B.addr.2.lcssa = phi i64* [ %B.addr.18, %for.cond10.loopexit ], [ %scevgep, %for.inc21.loopexit ]
123  %inc22 = add nsw i64 %j.07, 1
124  %exitcond14 = icmp ne i64 %inc22, %n
125  br i1 %exitcond14, label %for.cond4.preheader, label %for.inc24.loopexit
126
127for.inc24.loopexit:                               ; preds = %for.inc21
128  %B.addr.2.lcssa.lcssa = phi i64* [ %B.addr.2.lcssa, %for.inc21 ]
129  br label %for.inc24
130
131for.inc24:                                        ; preds = %for.inc24.loopexit, %for.cond1.preheader
132  %B.addr.1.lcssa = phi i64* [ %B.addr.012, %for.cond1.preheader ], [ %B.addr.2.lcssa.lcssa, %for.inc24.loopexit ]
133  %inc25 = add nsw i64 %i.011, 1
134  %exitcond15 = icmp ne i64 %inc25, %n
135  br i1 %exitcond15, label %for.cond1.preheader, label %for.end26.loopexit
136
137for.end26.loopexit:                               ; preds = %for.inc24
138  br label %for.end26
139
140for.end26:                                        ; preds = %for.end26.loopexit, %entry
141  ret void
142}
143
144
145;;  for (long int i = 0; i < n; i++)
146;;  for (long int j = 0; j < n; j++)
147;;  for (long int k = 0; k < n; k++)
148;;  for (long int l = 0; l < n; l++)
149;;  for (long int m = 0; m < n; m++)
150;;  for (long int o = 0; o < n; o++)
151;;  for (long int p = 0; p < n; p++)
152;;  for (long int q = 0; q < n; q++)
153;;  for (long int r = 0; r < n; r++)
154;;  for (long int s = 0; s < n; s++)
155;;  for (long int u = 0; u < n; u++)
156;;  for (long int t = 0; t < n; t++) {
157;;           A[i - 3] [j] [2] [k-1] [2*l + 1] [m] [p + q] [r + s] = i;
158;;    *B++ = A[i + 3] [2] [u] [1-k] [3*l - 1] [o] [1 + n] [t + 2];
159
160define void @p3(i64 %n, [100 x [100 x [100 x [100 x [100 x [100 x [100 x i64]]]]]]]* %A, i64* %B) nounwind uwtable ssp {
161entry:
162  %cmp44 = icmp sgt i64 %n, 0
163  br i1 %cmp44, label %for.cond1.preheader.preheader, label %for.end90
164
165; CHECK: da analyze - output [0 0 0 0 0 S * * * * S S]!
166; CHECK: da analyze - flow [-6 * * => * * * * * * * *] splitable!
167; CHECK: da analyze - split level = 3, iteration = 1!
168; CHECK: da analyze - confused!
169; CHECK: da analyze - consistent input [0 S 0 0 S 0 S S S S 0 0]!
170; CHECK: da analyze - confused!
171; CHECK: da analyze - output [* * * * * * * * * * * *]!
172
173for.cond1.preheader.preheader:                    ; preds = %entry
174  br label %for.cond1.preheader
175
176for.cond1.preheader:                              ; preds = %for.cond1.preheader.preheader, %for.inc88
177  %B.addr.046 = phi i64* [ %B.addr.1.lcssa, %for.inc88 ], [ %B, %for.cond1.preheader.preheader ]
178  %i.045 = phi i64 [ %inc89, %for.inc88 ], [ 0, %for.cond1.preheader.preheader ]
179  %cmp240 = icmp sgt i64 %n, 0
180  br i1 %cmp240, label %for.cond4.preheader.preheader, label %for.inc88
181
182for.cond4.preheader.preheader:                    ; preds = %for.cond1.preheader
183  br label %for.cond4.preheader
184
185for.cond4.preheader:                              ; preds = %for.cond4.preheader.preheader, %for.inc85
186  %B.addr.142 = phi i64* [ %B.addr.2.lcssa, %for.inc85 ], [ %B.addr.046, %for.cond4.preheader.preheader ]
187  %j.041 = phi i64 [ %inc86, %for.inc85 ], [ 0, %for.cond4.preheader.preheader ]
188  %cmp536 = icmp sgt i64 %n, 0
189  br i1 %cmp536, label %for.cond7.preheader.preheader, label %for.inc85
190
191for.cond7.preheader.preheader:                    ; preds = %for.cond4.preheader
192  br label %for.cond7.preheader
193
194for.cond7.preheader:                              ; preds = %for.cond7.preheader.preheader, %for.inc82
195  %B.addr.238 = phi i64* [ %B.addr.3.lcssa, %for.inc82 ], [ %B.addr.142, %for.cond7.preheader.preheader ]
196  %k.037 = phi i64 [ %inc83, %for.inc82 ], [ 0, %for.cond7.preheader.preheader ]
197  %cmp832 = icmp sgt i64 %n, 0
198  br i1 %cmp832, label %for.cond10.preheader.preheader, label %for.inc82
199
200for.cond10.preheader.preheader:                   ; preds = %for.cond7.preheader
201  br label %for.cond10.preheader
202
203for.cond10.preheader:                             ; preds = %for.cond10.preheader.preheader, %for.inc79
204  %B.addr.334 = phi i64* [ %B.addr.4.lcssa, %for.inc79 ], [ %B.addr.238, %for.cond10.preheader.preheader ]
205  %l.033 = phi i64 [ %inc80, %for.inc79 ], [ 0, %for.cond10.preheader.preheader ]
206  %cmp1128 = icmp sgt i64 %n, 0
207  br i1 %cmp1128, label %for.cond13.preheader.preheader, label %for.inc79
208
209for.cond13.preheader.preheader:                   ; preds = %for.cond10.preheader
210  br label %for.cond13.preheader
211
212for.cond13.preheader:                             ; preds = %for.cond13.preheader.preheader, %for.inc76
213  %B.addr.430 = phi i64* [ %B.addr.5.lcssa, %for.inc76 ], [ %B.addr.334, %for.cond13.preheader.preheader ]
214  %m.029 = phi i64 [ %inc77, %for.inc76 ], [ 0, %for.cond13.preheader.preheader ]
215  %cmp1424 = icmp sgt i64 %n, 0
216  br i1 %cmp1424, label %for.cond16.preheader.preheader, label %for.inc76
217
218for.cond16.preheader.preheader:                   ; preds = %for.cond13.preheader
219  br label %for.cond16.preheader
220
221for.cond16.preheader:                             ; preds = %for.cond16.preheader.preheader, %for.inc73
222  %B.addr.526 = phi i64* [ %B.addr.6.lcssa, %for.inc73 ], [ %B.addr.430, %for.cond16.preheader.preheader ]
223  %o.025 = phi i64 [ %inc74, %for.inc73 ], [ 0, %for.cond16.preheader.preheader ]
224  %cmp1720 = icmp sgt i64 %n, 0
225  br i1 %cmp1720, label %for.cond19.preheader.preheader, label %for.inc73
226
227for.cond19.preheader.preheader:                   ; preds = %for.cond16.preheader
228  br label %for.cond19.preheader
229
230for.cond19.preheader:                             ; preds = %for.cond19.preheader.preheader, %for.inc70
231  %B.addr.622 = phi i64* [ %B.addr.7.lcssa, %for.inc70 ], [ %B.addr.526, %for.cond19.preheader.preheader ]
232  %p.021 = phi i64 [ %inc71, %for.inc70 ], [ 0, %for.cond19.preheader.preheader ]
233  %cmp2016 = icmp sgt i64 %n, 0
234  br i1 %cmp2016, label %for.cond22.preheader.preheader, label %for.inc70
235
236for.cond22.preheader.preheader:                   ; preds = %for.cond19.preheader
237  br label %for.cond22.preheader
238
239for.cond22.preheader:                             ; preds = %for.cond22.preheader.preheader, %for.inc67
240  %B.addr.718 = phi i64* [ %B.addr.8.lcssa, %for.inc67 ], [ %B.addr.622, %for.cond22.preheader.preheader ]
241  %q.017 = phi i64 [ %inc68, %for.inc67 ], [ 0, %for.cond22.preheader.preheader ]
242  %cmp2312 = icmp sgt i64 %n, 0
243  br i1 %cmp2312, label %for.cond25.preheader.preheader, label %for.inc67
244
245for.cond25.preheader.preheader:                   ; preds = %for.cond22.preheader
246  br label %for.cond25.preheader
247
248for.cond25.preheader:                             ; preds = %for.cond25.preheader.preheader, %for.inc64
249  %B.addr.814 = phi i64* [ %B.addr.9.lcssa, %for.inc64 ], [ %B.addr.718, %for.cond25.preheader.preheader ]
250  %r.013 = phi i64 [ %inc65, %for.inc64 ], [ 0, %for.cond25.preheader.preheader ]
251  %cmp268 = icmp sgt i64 %n, 0
252  br i1 %cmp268, label %for.cond28.preheader.preheader, label %for.inc64
253
254for.cond28.preheader.preheader:                   ; preds = %for.cond25.preheader
255  br label %for.cond28.preheader
256
257for.cond28.preheader:                             ; preds = %for.cond28.preheader.preheader, %for.inc61
258  %B.addr.910 = phi i64* [ %B.addr.10.lcssa, %for.inc61 ], [ %B.addr.814, %for.cond28.preheader.preheader ]
259  %s.09 = phi i64 [ %inc62, %for.inc61 ], [ 0, %for.cond28.preheader.preheader ]
260  %cmp294 = icmp sgt i64 %n, 0
261  br i1 %cmp294, label %for.cond31.preheader.preheader, label %for.inc61
262
263for.cond31.preheader.preheader:                   ; preds = %for.cond28.preheader
264  br label %for.cond31.preheader
265
266for.cond31.preheader:                             ; preds = %for.cond31.preheader.preheader, %for.inc58
267  %u.06 = phi i64 [ %inc59, %for.inc58 ], [ 0, %for.cond31.preheader.preheader ]
268  %B.addr.105 = phi i64* [ %B.addr.11.lcssa, %for.inc58 ], [ %B.addr.910, %for.cond31.preheader.preheader ]
269  %cmp321 = icmp sgt i64 %n, 0
270  br i1 %cmp321, label %for.body33.preheader, label %for.inc58
271
272for.body33.preheader:                             ; preds = %for.cond31.preheader
273  br label %for.body33
274
275for.body33:                                       ; preds = %for.body33.preheader, %for.body33
276  %t.03 = phi i64 [ %inc, %for.body33 ], [ 0, %for.body33.preheader ]
277  %B.addr.112 = phi i64* [ %incdec.ptr, %for.body33 ], [ %B.addr.105, %for.body33.preheader ]
278  %add = add nsw i64 %r.013, %s.09
279  %add34 = add nsw i64 %p.021, %q.017
280  %mul = shl nsw i64 %l.033, 1
281  %add3547 = or i64 %mul, 1
282  %sub = add nsw i64 %k.037, -1
283  %sub36 = add nsw i64 %i.045, -3
284  %arrayidx43 = getelementptr inbounds [100 x [100 x [100 x [100 x [100 x [100 x [100 x i64]]]]]]], [100 x [100 x [100 x [100 x [100 x [100 x [100 x i64]]]]]]]* %A, i64 %sub36, i64 %j.041, i64 2, i64 %sub, i64 %add3547, i64 %m.029, i64 %add34, i64 %add
285  store i64 %i.045, i64* %arrayidx43, align 8
286  %add44 = add nsw i64 %t.03, 2
287  %add45 = add nsw i64 %n, 1
288  %mul46 = mul nsw i64 %l.033, 3
289  %sub47 = add nsw i64 %mul46, -1
290  %sub48 = sub nsw i64 1, %k.037
291  %add49 = add nsw i64 %i.045, 3
292  %arrayidx57 = getelementptr inbounds [100 x [100 x [100 x [100 x [100 x [100 x [100 x i64]]]]]]], [100 x [100 x [100 x [100 x [100 x [100 x [100 x i64]]]]]]]* %A, i64 %add49, i64 2, i64 %u.06, i64 %sub48, i64 %sub47, i64 %o.025, i64 %add45, i64 %add44
293  %0 = load i64, i64* %arrayidx57, align 8
294  %incdec.ptr = getelementptr inbounds i64, i64* %B.addr.112, i64 1
295  store i64 %0, i64* %B.addr.112, align 8
296  %inc = add nsw i64 %t.03, 1
297  %exitcond = icmp ne i64 %inc, %n
298  br i1 %exitcond, label %for.body33, label %for.inc58.loopexit
299
300for.inc58.loopexit:                               ; preds = %for.body33
301  %scevgep = getelementptr i64, i64* %B.addr.105, i64 %n
302  br label %for.inc58
303
304for.inc58:                                        ; preds = %for.inc58.loopexit, %for.cond31.preheader
305  %B.addr.11.lcssa = phi i64* [ %B.addr.105, %for.cond31.preheader ], [ %scevgep, %for.inc58.loopexit ]
306  %inc59 = add nsw i64 %u.06, 1
307  %exitcond48 = icmp ne i64 %inc59, %n
308  br i1 %exitcond48, label %for.cond31.preheader, label %for.inc61.loopexit
309
310for.inc61.loopexit:                               ; preds = %for.inc58
311  %B.addr.11.lcssa.lcssa = phi i64* [ %B.addr.11.lcssa, %for.inc58 ]
312  br label %for.inc61
313
314for.inc61:                                        ; preds = %for.inc61.loopexit, %for.cond28.preheader
315  %B.addr.10.lcssa = phi i64* [ %B.addr.910, %for.cond28.preheader ], [ %B.addr.11.lcssa.lcssa, %for.inc61.loopexit ]
316  %inc62 = add nsw i64 %s.09, 1
317  %exitcond49 = icmp ne i64 %inc62, %n
318  br i1 %exitcond49, label %for.cond28.preheader, label %for.inc64.loopexit
319
320for.inc64.loopexit:                               ; preds = %for.inc61
321  %B.addr.10.lcssa.lcssa = phi i64* [ %B.addr.10.lcssa, %for.inc61 ]
322  br label %for.inc64
323
324for.inc64:                                        ; preds = %for.inc64.loopexit, %for.cond25.preheader
325  %B.addr.9.lcssa = phi i64* [ %B.addr.814, %for.cond25.preheader ], [ %B.addr.10.lcssa.lcssa, %for.inc64.loopexit ]
326  %inc65 = add nsw i64 %r.013, 1
327  %exitcond50 = icmp ne i64 %inc65, %n
328  br i1 %exitcond50, label %for.cond25.preheader, label %for.inc67.loopexit
329
330for.inc67.loopexit:                               ; preds = %for.inc64
331  %B.addr.9.lcssa.lcssa = phi i64* [ %B.addr.9.lcssa, %for.inc64 ]
332  br label %for.inc67
333
334for.inc67:                                        ; preds = %for.inc67.loopexit, %for.cond22.preheader
335  %B.addr.8.lcssa = phi i64* [ %B.addr.718, %for.cond22.preheader ], [ %B.addr.9.lcssa.lcssa, %for.inc67.loopexit ]
336  %inc68 = add nsw i64 %q.017, 1
337  %exitcond51 = icmp ne i64 %inc68, %n
338  br i1 %exitcond51, label %for.cond22.preheader, label %for.inc70.loopexit
339
340for.inc70.loopexit:                               ; preds = %for.inc67
341  %B.addr.8.lcssa.lcssa = phi i64* [ %B.addr.8.lcssa, %for.inc67 ]
342  br label %for.inc70
343
344for.inc70:                                        ; preds = %for.inc70.loopexit, %for.cond19.preheader
345  %B.addr.7.lcssa = phi i64* [ %B.addr.622, %for.cond19.preheader ], [ %B.addr.8.lcssa.lcssa, %for.inc70.loopexit ]
346  %inc71 = add nsw i64 %p.021, 1
347  %exitcond52 = icmp ne i64 %inc71, %n
348  br i1 %exitcond52, label %for.cond19.preheader, label %for.inc73.loopexit
349
350for.inc73.loopexit:                               ; preds = %for.inc70
351  %B.addr.7.lcssa.lcssa = phi i64* [ %B.addr.7.lcssa, %for.inc70 ]
352  br label %for.inc73
353
354for.inc73:                                        ; preds = %for.inc73.loopexit, %for.cond16.preheader
355  %B.addr.6.lcssa = phi i64* [ %B.addr.526, %for.cond16.preheader ], [ %B.addr.7.lcssa.lcssa, %for.inc73.loopexit ]
356  %inc74 = add nsw i64 %o.025, 1
357  %exitcond53 = icmp ne i64 %inc74, %n
358  br i1 %exitcond53, label %for.cond16.preheader, label %for.inc76.loopexit
359
360for.inc76.loopexit:                               ; preds = %for.inc73
361  %B.addr.6.lcssa.lcssa = phi i64* [ %B.addr.6.lcssa, %for.inc73 ]
362  br label %for.inc76
363
364for.inc76:                                        ; preds = %for.inc76.loopexit, %for.cond13.preheader
365  %B.addr.5.lcssa = phi i64* [ %B.addr.430, %for.cond13.preheader ], [ %B.addr.6.lcssa.lcssa, %for.inc76.loopexit ]
366  %inc77 = add nsw i64 %m.029, 1
367  %exitcond54 = icmp ne i64 %inc77, %n
368  br i1 %exitcond54, label %for.cond13.preheader, label %for.inc79.loopexit
369
370for.inc79.loopexit:                               ; preds = %for.inc76
371  %B.addr.5.lcssa.lcssa = phi i64* [ %B.addr.5.lcssa, %for.inc76 ]
372  br label %for.inc79
373
374for.inc79:                                        ; preds = %for.inc79.loopexit, %for.cond10.preheader
375  %B.addr.4.lcssa = phi i64* [ %B.addr.334, %for.cond10.preheader ], [ %B.addr.5.lcssa.lcssa, %for.inc79.loopexit ]
376  %inc80 = add nsw i64 %l.033, 1
377  %exitcond55 = icmp ne i64 %inc80, %n
378  br i1 %exitcond55, label %for.cond10.preheader, label %for.inc82.loopexit
379
380for.inc82.loopexit:                               ; preds = %for.inc79
381  %B.addr.4.lcssa.lcssa = phi i64* [ %B.addr.4.lcssa, %for.inc79 ]
382  br label %for.inc82
383
384for.inc82:                                        ; preds = %for.inc82.loopexit, %for.cond7.preheader
385  %B.addr.3.lcssa = phi i64* [ %B.addr.238, %for.cond7.preheader ], [ %B.addr.4.lcssa.lcssa, %for.inc82.loopexit ]
386  %inc83 = add nsw i64 %k.037, 1
387  %exitcond56 = icmp ne i64 %inc83, %n
388  br i1 %exitcond56, label %for.cond7.preheader, label %for.inc85.loopexit
389
390for.inc85.loopexit:                               ; preds = %for.inc82
391  %B.addr.3.lcssa.lcssa = phi i64* [ %B.addr.3.lcssa, %for.inc82 ]
392  br label %for.inc85
393
394for.inc85:                                        ; preds = %for.inc85.loopexit, %for.cond4.preheader
395  %B.addr.2.lcssa = phi i64* [ %B.addr.142, %for.cond4.preheader ], [ %B.addr.3.lcssa.lcssa, %for.inc85.loopexit ]
396  %inc86 = add nsw i64 %j.041, 1
397  %exitcond57 = icmp ne i64 %inc86, %n
398  br i1 %exitcond57, label %for.cond4.preheader, label %for.inc88.loopexit
399
400for.inc88.loopexit:                               ; preds = %for.inc85
401  %B.addr.2.lcssa.lcssa = phi i64* [ %B.addr.2.lcssa, %for.inc85 ]
402  br label %for.inc88
403
404for.inc88:                                        ; preds = %for.inc88.loopexit, %for.cond1.preheader
405  %B.addr.1.lcssa = phi i64* [ %B.addr.046, %for.cond1.preheader ], [ %B.addr.2.lcssa.lcssa, %for.inc88.loopexit ]
406  %inc89 = add nsw i64 %i.045, 1
407  %exitcond58 = icmp ne i64 %inc89, %n
408  br i1 %exitcond58, label %for.cond1.preheader, label %for.end90.loopexit
409
410for.end90.loopexit:                               ; preds = %for.inc88
411  br label %for.end90
412
413for.end90:                                        ; preds = %for.end90.loopexit, %entry
414  ret void
415}
416
417
418;;void p4(int *A, int *B, long int n) {
419;;  for (char i = 0; i < n; i++) {
420;;    A[i + 2] = i;
421;;    *B++ = A[i];
422
423define void @p4(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
424entry:
425  %cmp1 = icmp sgt i64 %n, 0
426  br i1 %cmp1, label %for.body.preheader, label %for.end
427
428; CHECK: da analyze - output [*]!
429; CHECK: da analyze - flow [*|<]!
430; CHECK: da analyze - confused!
431; CHECK: da analyze - none!
432; CHECK: da analyze - confused!
433; CHECK: da analyze - none!
434
435for.body.preheader:                               ; preds = %entry
436  br label %for.body
437
438for.body:                                         ; preds = %for.body.preheader, %for.body
439  %i.03 = phi i8 [ %inc, %for.body ], [ 0, %for.body.preheader ]
440  %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
441  %conv2 = sext i8 %i.03 to i32
442  %conv3 = sext i8 %i.03 to i64
443  %add = add i64 %conv3, 2
444  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
445  store i32 %conv2, i32* %arrayidx, align 4
446  %idxprom4 = sext i8 %i.03 to i64
447  %arrayidx5 = getelementptr inbounds i32, i32* %A, i64 %idxprom4
448  %0 = load i32, i32* %arrayidx5, align 4
449  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
450  store i32 %0, i32* %B.addr.02, align 4
451  %inc = add i8 %i.03, 1
452  %conv = sext i8 %inc to i64
453  %cmp = icmp slt i64 %conv, %n
454  br i1 %cmp, label %for.body, label %for.end.loopexit
455
456for.end.loopexit:                                 ; preds = %for.body
457  br label %for.end
458
459for.end:                                          ; preds = %for.end.loopexit, %entry
460  ret void
461}
462
463
464;;void p5(int *A, int *B, long int n) {
465;;  for (short i = 0; i < n; i++) {
466;;    A[i + 2] = i;
467;;    *B++ = A[i];
468
469define void @p5(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
470entry:
471  %cmp1 = icmp sgt i64 %n, 0
472  br i1 %cmp1, label %for.body.preheader, label %for.end
473
474; CHECK: da analyze - output [*]!
475; CHECK: da analyze - flow [*|<]!
476; CHECK: da analyze - confused!
477; CHECK: da analyze - none!
478; CHECK: da analyze - confused!
479; CHECK: da analyze - none!
480
481for.body.preheader:                               ; preds = %entry
482  br label %for.body
483
484for.body:                                         ; preds = %for.body.preheader, %for.body
485  %i.03 = phi i16 [ %inc, %for.body ], [ 0, %for.body.preheader ]
486  %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
487  %conv2 = sext i16 %i.03 to i32
488  %conv3 = sext i16 %i.03 to i64
489  %add = add i64 %conv3, 2
490  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
491  store i32 %conv2, i32* %arrayidx, align 4
492  %idxprom4 = sext i16 %i.03 to i64
493  %arrayidx5 = getelementptr inbounds i32, i32* %A, i64 %idxprom4
494  %0 = load i32, i32* %arrayidx5, align 4
495  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
496  store i32 %0, i32* %B.addr.02, align 4
497  %inc = add i16 %i.03, 1
498  %conv = sext i16 %inc to i64
499  %cmp = icmp slt i64 %conv, %n
500  br i1 %cmp, label %for.body, label %for.end.loopexit
501
502for.end.loopexit:                                 ; preds = %for.body
503  br label %for.end
504
505for.end:                                          ; preds = %for.end.loopexit, %entry
506  ret void
507}
508
509
510;;void p6(int *A, int *B, long int n) {
511;;  for (int i = 0; i < n; i++) {
512;;    A[i + 2] = i;
513;;    *B++ = A[i];
514
515define void @p6(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
516entry:
517  %cmp1 = icmp sgt i64 %n, 0
518  br i1 %cmp1, label %for.body.preheader, label %for.end
519
520; CHECK: da analyze - none!
521; CHECK: da analyze - consistent flow [2]!
522; CHECK: da analyze - confused!
523; CHECK: da analyze - none!
524; CHECK: da analyze - confused!
525; CHECK: da analyze - none!
526
527for.body.preheader:                               ; preds = %entry
528  br label %for.body
529
530for.body:                                         ; preds = %for.body.preheader, %for.body
531  %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
532  %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
533  %0 = add nsw i64 %indvars.iv, 2
534  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %0
535  %1 = trunc i64 %indvars.iv to i32
536  store i32 %1, i32* %arrayidx, align 4
537  %arrayidx3 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
538  %2 = load i32, i32* %arrayidx3, align 4
539  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
540  store i32 %2, i32* %B.addr.02, align 4
541  %indvars.iv.next = add i64 %indvars.iv, 1
542  %exitcond = icmp ne i64 %indvars.iv.next, %n
543  br i1 %exitcond, label %for.body, label %for.end.loopexit
544
545for.end.loopexit:                                 ; preds = %for.body
546  br label %for.end
547
548for.end:                                          ; preds = %for.end.loopexit, %entry
549  ret void
550}
551
552
553;;void p7(unsigned *A, unsigned *B,  char n) {
554;;  A[n] = 0;
555;;  *B = A[n + 1];
556
557define void @p7(i32* %A, i32* %B, i8 signext %n) nounwind uwtable ssp {
558entry:
559  %idxprom = sext i8 %n to i64
560  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %idxprom
561
562; CHECK: da analyze - none!
563; CHECK: da analyze - none!
564; CHECK: da analyze - confused!
565; CHECK: da analyze - none!
566; CHECK: da analyze - confused!
567; CHECK: da analyze - none!
568
569  store i32 0, i32* %arrayidx, align 4
570  %conv = sext i8 %n to i64
571  %add = add i64 %conv, 1
572  %arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %add
573  %0 = load i32, i32* %arrayidx2, align 4
574  store i32 %0, i32* %B, align 4
575  ret void
576}
577
578
579;;void p8(unsigned *A, unsigned *B,  short n) {
580;;  A[n] = 0;
581;;  *B = A[n + 1];
582
583define void @p8(i32* %A, i32* %B, i16 signext %n) nounwind uwtable ssp {
584entry:
585  %idxprom = sext i16 %n to i64
586  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %idxprom
587  store i32 0, i32* %arrayidx, align 4
588
589; CHECK: da analyze - none!
590; CHECK: da analyze - none!
591; CHECK: da analyze - confused!
592; CHECK: da analyze - none!
593; CHECK: da analyze - confused!
594; CHECK: da analyze - none!
595
596  %conv = sext i16 %n to i64
597  %add = add i64 %conv, 1
598  %arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %add
599  %0 = load i32, i32* %arrayidx2, align 4
600  store i32 %0, i32* %B, align 4
601  ret void
602}
603
604
605;;void p9(unsigned *A, unsigned *B,  int n) {
606;;  A[n] = 0;
607;;  *B = A[n + 1];
608
609define void @p9(i32* %A, i32* %B, i32 %n) nounwind uwtable ssp {
610entry:
611  %idxprom = sext i32 %n to i64
612  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %idxprom
613  store i32 0, i32* %arrayidx, align 4
614
615; CHECK: da analyze - none!
616; CHECK: da analyze - none!
617; CHECK: da analyze - confused!
618; CHECK: da analyze - none!
619; CHECK: da analyze - confused!
620; CHECK: da analyze - none!
621
622  %add = add nsw i32 %n, 1
623  %idxprom1 = sext i32 %add to i64
624  %arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %idxprom1
625  %0 = load i32, i32* %arrayidx2, align 4
626  store i32 %0, i32* %B, align 4
627  ret void
628}
629
630
631;;void p10(unsigned *A, unsigned *B,  unsigned n) {
632;;  A[n] = 0;
633;;  *B = A[n + 1];
634
635define void @p10(i32* %A, i32* %B, i32 %n) nounwind uwtable ssp {
636entry:
637  %idxprom = zext i32 %n to i64
638  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %idxprom
639  store i32 0, i32* %arrayidx, align 4
640
641; CHECK: da analyze - none!
642; CHECK: da analyze - none!
643; CHECK: da analyze - confused!
644; CHECK: da analyze - none!
645; CHECK: da analyze - confused!
646; CHECK: da analyze - none!
647
648  %add = add i32 %n, 1
649  %idxprom1 = zext i32 %add to i64
650  %arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %idxprom1
651  %0 = load i32, i32* %arrayidx2, align 4
652  store i32 %0, i32* %B, align 4
653  ret void
654}
655
656
657;;typedef struct { int v; } S;
658;;
659;;void f(S *s, unsigned size) {
660;;  S *i = s, *e = s + size - 1;
661;;  while (i != e) {
662;;    *i = *(i + 1);
663;;    ++i;
664
665%struct.S = type { i32 }
666
667define void @f(%struct.S* %s, i32 %size) nounwind uwtable ssp {
668entry:
669  %idx.ext = zext i32 %size to i64
670  %add.ptr.sum = add i64 %idx.ext, -1
671  %add.ptr1 = getelementptr inbounds %struct.S, %struct.S* %s, i64 %add.ptr.sum
672  %cmp1 = icmp eq i64 %add.ptr.sum, 0
673  br i1 %cmp1, label %while.end, label %while.body.preheader
674
675; CHECK: da analyze - none!
676; CHECK: da analyze - consistent anti [1]!
677; CHECK: da analyze - none!
678
679while.body.preheader:                             ; preds = %entry
680  br label %while.body
681
682while.body:                                       ; preds = %while.body.preheader, %while.body
683  %i.02 = phi %struct.S* [ %incdec.ptr, %while.body ], [ %s, %while.body.preheader ]
684  %0 = getelementptr inbounds %struct.S, %struct.S* %i.02, i64 1, i32 0
685  %1 = load i32, i32* %0, align 4
686  %2 = getelementptr inbounds %struct.S, %struct.S* %i.02, i64 0, i32 0
687  store i32 %1, i32* %2, align 4
688  %incdec.ptr = getelementptr inbounds %struct.S, %struct.S* %i.02, i64 1
689  %cmp = icmp eq %struct.S* %incdec.ptr, %add.ptr1
690  br i1 %cmp, label %while.end.loopexit, label %while.body
691
692while.end.loopexit:                               ; preds = %while.body
693  br label %while.end
694
695while.end:                                        ; preds = %while.end.loopexit, %entry
696  ret void
697}
698
699declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
700