1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 4
2 ; RUN: opt -passes='print<access-info>' -disable-output < %s 2>&1 | FileCheck %s
4 define void @forward_dist_7(ptr %A, ptr noalias %B) {
5 ; CHECK-LABEL: 'forward_dist_7'
7 ; CHECK-NEXT: Report: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop
8 ; CHECK-NEXT: Forward loop carried data dependence that prevents store-to-load forwarding.
9 ; CHECK-NEXT: Dependences:
10 ; CHECK-NEXT: ForwardButPreventsForwarding:
11 ; CHECK-NEXT: store i32 0, ptr %gep.2, align 4 ->
12 ; CHECK-NEXT: %l = load i32, ptr %gep.1, align 4
14 ; CHECK-NEXT: Run-time memory checks:
15 ; CHECK-NEXT: Grouped accesses:
17 ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
18 ; CHECK-NEXT: SCEV assumptions:
20 ; CHECK-NEXT: Expressions re-written:
26 %iv = phi i64 [ 0, %entry ], [ %next, %loop ]
27 %gep.1 = getelementptr i32, ptr %A, i64 %iv
28 %gep.2 = getelementptr i32, ptr %gep.1, i64 7
29 store i32 0, ptr %gep.2, align 4
30 %l = load i32, ptr %gep.1
32 %next = add nuw nsw i64 %iv, 1
33 %ec = icmp eq i64 %iv, 1000
34 br i1 %ec, label %exit, label %loop
40 define void @forward_dist_9(ptr %A, ptr noalias %B) {
41 ; CHECK-LABEL: 'forward_dist_9'
43 ; CHECK-NEXT: Report: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop
44 ; CHECK-NEXT: Forward loop carried data dependence that prevents store-to-load forwarding.
45 ; CHECK-NEXT: Dependences:
46 ; CHECK-NEXT: ForwardButPreventsForwarding:
47 ; CHECK-NEXT: store i32 0, ptr %gep.2, align 4 ->
48 ; CHECK-NEXT: %l = load i32, ptr %gep.1, align 4
50 ; CHECK-NEXT: Run-time memory checks:
51 ; CHECK-NEXT: Grouped accesses:
53 ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
54 ; CHECK-NEXT: SCEV assumptions:
56 ; CHECK-NEXT: Expressions re-written:
62 %iv = phi i64 [ 0, %entry ], [ %next, %loop ]
63 %gep.1 = getelementptr i32, ptr %A, i64 %iv
64 %gep.2 = getelementptr i32, ptr %gep.1, i64 9
65 store i32 0, ptr %gep.2, align 4
66 %l = load i32, ptr %gep.1
68 %next = add nuw nsw i64 %iv, 1
69 %ec = icmp eq i64 %iv, 1000
70 br i1 %ec, label %exit, label %loop
76 define void @forward_dist_11(ptr %A, ptr noalias %B) {
77 ; CHECK-LABEL: 'forward_dist_11'
79 ; CHECK-NEXT: Report: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop
80 ; CHECK-NEXT: Forward loop carried data dependence that prevents store-to-load forwarding.
81 ; CHECK-NEXT: Dependences:
82 ; CHECK-NEXT: ForwardButPreventsForwarding:
83 ; CHECK-NEXT: store i32 0, ptr %gep.2, align 4 ->
84 ; CHECK-NEXT: %l = load i32, ptr %gep.1, align 4
86 ; CHECK-NEXT: Run-time memory checks:
87 ; CHECK-NEXT: Grouped accesses:
89 ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
90 ; CHECK-NEXT: SCEV assumptions:
92 ; CHECK-NEXT: Expressions re-written:
98 %iv = phi i64 [ 0, %entry ], [ %next, %loop ]
99 %gep.1 = getelementptr i32, ptr %A, i64 %iv
100 %gep.2 = getelementptr i32, ptr %gep.1, i64 9
101 store i32 0, ptr %gep.2, align 4
102 %l = load i32, ptr %gep.1
104 %next = add nuw nsw i64 %iv, 1
105 %ec = icmp eq i64 %iv, 1000
106 br i1 %ec, label %exit, label %loop
112 define void @forward_dist_13(ptr %A, ptr noalias %B) {
113 ; CHECK-LABEL: 'forward_dist_13'
115 ; CHECK-NEXT: Report: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop
116 ; CHECK-NEXT: Forward loop carried data dependence that prevents store-to-load forwarding.
117 ; CHECK-NEXT: Dependences:
118 ; CHECK-NEXT: ForwardButPreventsForwarding:
119 ; CHECK-NEXT: store i32 0, ptr %gep.2, align 4 ->
120 ; CHECK-NEXT: %l = load i32, ptr %gep.1, align 4
122 ; CHECK-NEXT: Run-time memory checks:
123 ; CHECK-NEXT: Grouped accesses:
125 ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
126 ; CHECK-NEXT: SCEV assumptions:
128 ; CHECK-NEXT: Expressions re-written:
134 %iv = phi i64 [ 0, %entry ], [ %next, %loop ]
135 %gep.1 = getelementptr i32, ptr %A, i64 %iv
136 %gep.2 = getelementptr i32, ptr %gep.1, i64 13
137 store i32 0, ptr %gep.2, align 4
138 %l = load i32, ptr %gep.1
140 %next = add nuw nsw i64 %iv, 1
141 %ec = icmp eq i64 %iv, 1000
142 br i1 %ec, label %exit, label %loop
148 define void @forward_dist_15(ptr %A, ptr noalias %B) {
149 ; CHECK-LABEL: 'forward_dist_15'
151 ; CHECK-NEXT: Report: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop
152 ; CHECK-NEXT: Forward loop carried data dependence that prevents store-to-load forwarding.
153 ; CHECK-NEXT: Dependences:
154 ; CHECK-NEXT: ForwardButPreventsForwarding:
155 ; CHECK-NEXT: store i32 0, ptr %gep.2, align 4 ->
156 ; CHECK-NEXT: %l = load i32, ptr %gep.1, align 4
158 ; CHECK-NEXT: Run-time memory checks:
159 ; CHECK-NEXT: Grouped accesses:
161 ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
162 ; CHECK-NEXT: SCEV assumptions:
164 ; CHECK-NEXT: Expressions re-written:
170 %iv = phi i64 [ 0, %entry ], [ %next, %loop ]
171 %gep.1 = getelementptr i32, ptr %A, i64 %iv
172 %gep.2 = getelementptr i32, ptr %gep.1, i64 13
173 store i32 0, ptr %gep.2, align 4
174 %l = load i32, ptr %gep.1
176 %next = add nuw nsw i64 %iv, 1
177 %ec = icmp eq i64 %iv, 1000
178 br i1 %ec, label %exit, label %loop
184 define void @forward_dist_17(ptr %A, ptr noalias %B) {
185 ; CHECK-LABEL: 'forward_dist_17'
187 ; CHECK-NEXT: Report: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop
188 ; CHECK-NEXT: Forward loop carried data dependence that prevents store-to-load forwarding.
189 ; CHECK-NEXT: Dependences:
190 ; CHECK-NEXT: ForwardButPreventsForwarding:
191 ; CHECK-NEXT: store i32 0, ptr %gep.2, align 4 ->
192 ; CHECK-NEXT: %l = load i32, ptr %gep.1, align 4
194 ; CHECK-NEXT: Run-time memory checks:
195 ; CHECK-NEXT: Grouped accesses:
197 ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
198 ; CHECK-NEXT: SCEV assumptions:
200 ; CHECK-NEXT: Expressions re-written:
206 %iv = phi i64 [ 0, %entry ], [ %next, %loop ]
207 %gep.1 = getelementptr i32, ptr %A, i64 %iv
208 %gep.2 = getelementptr i32, ptr %gep.1, i64 17
209 store i32 0, ptr %gep.2, align 4
210 %l = load i32, ptr %gep.1
212 %next = add nuw nsw i64 %iv, 1
213 %ec = icmp eq i64 %iv, 1000
214 br i1 %ec, label %exit, label %loop
220 define void @forward_dist_19(ptr %A, ptr noalias %B) {
221 ; CHECK-LABEL: 'forward_dist_19'
223 ; CHECK-NEXT: Report: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop
224 ; CHECK-NEXT: Forward loop carried data dependence that prevents store-to-load forwarding.
225 ; CHECK-NEXT: Dependences:
226 ; CHECK-NEXT: ForwardButPreventsForwarding:
227 ; CHECK-NEXT: store i32 0, ptr %gep.2, align 4 ->
228 ; CHECK-NEXT: %l = load i32, ptr %gep.1, align 4
230 ; CHECK-NEXT: Run-time memory checks:
231 ; CHECK-NEXT: Grouped accesses:
233 ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
234 ; CHECK-NEXT: SCEV assumptions:
236 ; CHECK-NEXT: Expressions re-written:
242 %iv = phi i64 [ 0, %entry ], [ %next, %loop ]
243 %gep.1 = getelementptr i32, ptr %A, i64 %iv
244 %gep.2 = getelementptr i32, ptr %gep.1, i64 19
245 store i32 0, ptr %gep.2, align 4
246 %l = load i32, ptr %gep.1
248 %next = add nuw nsw i64 %iv, 1
249 %ec = icmp eq i64 %iv, 1000
250 br i1 %ec, label %exit, label %loop
256 @A = global [37 x [37 x double]] zeroinitializer, align 8
258 define void @unknown_loop_bounds(i64 %x, i64 %y) {
259 ; CHECK-LABEL: 'unknown_loop_bounds'
261 ; CHECK-NEXT: Report: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop
262 ; CHECK-NEXT: Backward loop carried data dependence that prevents store-to-load forwarding.
263 ; CHECK-NEXT: Dependences:
264 ; CHECK-NEXT: BackwardVectorizableButPreventsForwarding:
265 ; CHECK-NEXT: %l = load double, ptr %gep.0, align 8 ->
266 ; CHECK-NEXT: store double %l, ptr %gep.1, align 8
268 ; CHECK-NEXT: Run-time memory checks:
269 ; CHECK-NEXT: Grouped accesses:
271 ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
272 ; CHECK-NEXT: SCEV assumptions:
274 ; CHECK-NEXT: Expressions re-written:
275 ; CHECK-NEXT: outer.header:
276 ; CHECK-NEXT: Report: loop is not the innermost loop
277 ; CHECK-NEXT: Dependences:
278 ; CHECK-NEXT: Run-time memory checks:
279 ; CHECK-NEXT: Grouped accesses:
281 ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
282 ; CHECK-NEXT: SCEV assumptions:
284 ; CHECK-NEXT: Expressions re-written:
287 br label %outer.header
290 %outer.iv = phi i64 [ 0, %entry ], [ %outer.iv.next, %outer.latch ]
291 %outer.iv.next = add nuw nsw i64 %outer.iv, 1
295 %inner.iv = phi i64 [ 0, %outer.header ], [ %inner.iv.next, %inner ]
296 %gep.0 = getelementptr inbounds [37 x [37 x double]], ptr @A, i64 0, i64 %outer.iv, i64 %inner.iv
297 %l = load double, ptr %gep.0, align 8
298 %gep.1 = getelementptr inbounds [37 x [37 x double]], ptr @A, i64 0, i64 %outer.iv.next, i64 %inner.iv
299 store double %l, ptr %gep.1, align 8
300 %inner.iv.next = add nuw nsw i64 %inner.iv, 1
301 %inner.ec = icmp eq i64 %inner.iv.next, %y
302 br i1 %inner.ec, label %outer.latch, label %inner
305 %outer.ec = icmp eq i64 %outer.iv.next, %x
306 br i1 %outer.ec, label %exit, label %outer.header