1 ; RUN: opt < %s -analyze -basicaa -da | FileCheck %s
3 ; ModuleID = 'WeakZeroDstSIV.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++)
12 define void @weakzerodst0(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
16 for.body: ; preds = %for.body, %entry
17 %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
18 %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
19 %conv = trunc i64 %i.02 to i32
20 %mul = shl i64 %i.02, 1
21 %add = add i64 %mul, 10
22 %arrayidx = getelementptr inbounds i32* %A, i64 %add
23 store i32 %conv, i32* %arrayidx, align 4
24 %arrayidx1 = getelementptr inbounds i32* %A, i64 10
25 %0 = load i32* %arrayidx1, align 4
26 ; CHECK: da analyze - flow [p<=|<]!
27 %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
28 store i32 %0, i32* %B.addr.01, align 4
29 %inc = add i64 %i.02, 1
30 %cmp = icmp ult i64 %inc, 30
31 br i1 %cmp, label %for.body, label %for.end
33 for.end: ; preds = %for.body
38 ;; for (long unsigned i = 0; i < n; i++)
42 define void @weakzerodst1(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
44 %cmp1 = icmp eq i64 %n, 0
45 br i1 %cmp1, label %for.end, label %for.body
47 for.body: ; preds = %for.body, %entry
48 %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
49 %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ]
50 %conv = trunc i64 %i.03 to i32
51 %mul = mul i64 %i.03, %n
52 %add = add i64 %mul, 10
53 %arrayidx = getelementptr inbounds i32* %A, i64 %add
54 store i32 %conv, i32* %arrayidx, align 4
55 %arrayidx1 = getelementptr inbounds i32* %A, i64 10
56 %0 = load i32* %arrayidx1, align 4
57 ; CHECK: da analyze - flow [p<=|<]!
58 %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
59 store i32 %0, i32* %B.addr.02, align 4
60 %inc = add i64 %i.03, 1
61 %cmp = icmp ult i64 %inc, %n
62 br i1 %cmp, label %for.body, label %for.end
64 for.end: ; preds = %for.body, %entry
69 ;; for (long unsigned i = 0; i < 5; i++)
73 define void @weakzerodst2(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
77 for.body: ; preds = %for.body, %entry
78 %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
79 %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
80 %conv = trunc i64 %i.02 to i32
81 %mul = shl i64 %i.02, 1
82 %arrayidx = getelementptr inbounds i32* %A, i64 %mul
83 store i32 %conv, i32* %arrayidx, align 4
84 %arrayidx1 = getelementptr inbounds i32* %A, i64 10
85 %0 = load i32* %arrayidx1, align 4
86 ; CHECK: da analyze - none!
87 %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
88 store i32 %0, i32* %B.addr.01, align 4
89 %inc = add i64 %i.02, 1
90 %cmp = icmp ult i64 %inc, 5
91 br i1 %cmp, label %for.body, label %for.end
93 for.end: ; preds = %for.body
98 ;; for (long unsigned i = 0; i < 6; i++)
102 define void @weakzerodst3(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
106 for.body: ; preds = %for.body, %entry
107 %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
108 %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
109 %conv = trunc i64 %i.02 to i32
110 %mul = shl i64 %i.02, 1
111 %arrayidx = getelementptr inbounds i32* %A, i64 %mul
112 store i32 %conv, i32* %arrayidx, align 4
113 %arrayidx1 = getelementptr inbounds i32* %A, i64 10
114 %0 = load i32* %arrayidx1, align 4
115 ; CHECK: da analyze - flow [=>p|<]!
116 %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
117 store i32 %0, i32* %B.addr.01, align 4
118 %inc = add i64 %i.02, 1
119 %cmp = icmp ult i64 %inc, 6
120 br i1 %cmp, label %for.body, label %for.end
122 for.end: ; preds = %for.body
127 ;; for (long unsigned i = 0; i < 7; i++)
131 define void @weakzerodst4(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
135 for.body: ; preds = %for.body, %entry
136 %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
137 %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
138 %conv = trunc i64 %i.02 to i32
139 %mul = shl i64 %i.02, 1
140 %arrayidx = getelementptr inbounds i32* %A, i64 %mul
141 store i32 %conv, i32* %arrayidx, align 4
142 %arrayidx1 = getelementptr inbounds i32* %A, i64 10
143 %0 = load i32* %arrayidx1, align 4
144 ; CHECK: da analyze - flow [*|<]!
145 %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
146 store i32 %0, i32* %B.addr.01, align 4
147 %inc = add i64 %i.02, 1
148 %cmp = icmp ult i64 %inc, 7
149 br i1 %cmp, label %for.body, label %for.end
151 for.end: ; preds = %for.body
156 ;; for (long unsigned i = 0; i < 7; i++)
160 define void @weakzerodst5(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
164 for.body: ; preds = %for.body, %entry
165 %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
166 %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
167 %conv = trunc i64 %i.02 to i32
168 %mul = shl i64 %i.02, 1
169 %arrayidx = getelementptr inbounds i32* %A, i64 %mul
170 store i32 %conv, i32* %arrayidx, align 4
171 %arrayidx1 = getelementptr inbounds i32* %A, i64 -10
172 %0 = load i32* %arrayidx1, align 4
173 ; CHECK: da analyze - none!
174 %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
175 store i32 %0, i32* %B.addr.01, align 4
176 %inc = add i64 %i.02, 1
177 %cmp = icmp ult i64 %inc, 7
178 br i1 %cmp, label %for.body, label %for.end
180 for.end: ; preds = %for.body
185 ;; for (long unsigned i = 0; i < n; i++)
189 define void @weakzerodst6(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
191 %cmp1 = icmp eq i64 %n, 0
192 br i1 %cmp1, label %for.end, label %for.body
194 for.body: ; preds = %for.body, %entry
195 %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
196 %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ]
197 %conv = trunc i64 %i.03 to i32
198 %mul = mul i64 %i.03, 3
199 %arrayidx = getelementptr inbounds i32* %A, i64 %mul
200 store i32 %conv, i32* %arrayidx, align 4
201 %arrayidx1 = getelementptr inbounds i32* %A, i64 10
202 %0 = load i32* %arrayidx1, align 4
203 ; CHECK: da analyze - none!
204 %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
205 store i32 %0, i32* %B.addr.02, align 4
206 %inc = add i64 %i.03, 1
207 %cmp = icmp ult i64 %inc, %n
208 br i1 %cmp, label %for.body, label %for.end
210 for.end: ; preds = %for.body, %entry