1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 3
2 ; RUN: opt -passes='print<access-info>' -disable-output %s 2>&1 | FileCheck %s
4 ; Test cases for using the backedge-taken-count to rule out dependencies between
5 ; an invariant and strided accesses.
7 define void @test_distance_greater_than_BTC_100(ptr %a) {
8 ; CHECK-LABEL: 'test_distance_greater_than_BTC_100'
10 ; 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
11 ; CHECK-NEXT: Unknown data dependence.
12 ; CHECK-NEXT: Dependences:
13 ; CHECK-NEXT: Unknown:
14 ; CHECK-NEXT: %l = load i32, ptr %gep.x, align 4 ->
15 ; CHECK-NEXT: store i32 %l, ptr %gep, align 4
17 ; CHECK-NEXT: Run-time memory checks:
18 ; CHECK-NEXT: Grouped accesses:
20 ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
21 ; CHECK-NEXT: SCEV assumptions:
23 ; CHECK-NEXT: Expressions re-written:
26 %gep.x = getelementptr i32, ptr %a, i32 100
30 %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
31 %gep = getelementptr i32, ptr %a, i32 %iv
32 %l = load i32, ptr %gep.x
33 store i32 %l, ptr %gep
34 %iv.next = add i32 %iv, 1
35 %ec = icmp eq i32 %iv.next, 100
36 br i1 %ec, label %exit, label %loop
42 define void @test_distance_much_greater_than_BTC_100(ptr %a) {
43 ; CHECK-LABEL: 'test_distance_much_greater_than_BTC_100'
45 ; 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
46 ; CHECK-NEXT: Unknown data dependence.
47 ; CHECK-NEXT: Dependences:
48 ; CHECK-NEXT: Unknown:
49 ; CHECK-NEXT: %l = load i32, ptr %gep.x, align 4 ->
50 ; CHECK-NEXT: store i32 %l, ptr %gep, align 4
52 ; CHECK-NEXT: Run-time memory checks:
53 ; CHECK-NEXT: Grouped accesses:
55 ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
56 ; CHECK-NEXT: SCEV assumptions:
58 ; CHECK-NEXT: Expressions re-written:
61 %gep.x = getelementptr i32, ptr %a, i32 200
65 %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
66 %gep = getelementptr i32, ptr %a, i32 %iv
67 %l = load i32, ptr %gep.x
68 store i32 %l, ptr %gep
69 %iv.next = add i32 %iv, 1
70 %ec = icmp eq i32 %iv.next, 100
71 br i1 %ec, label %exit, label %loop
77 define void @test_distance_equal_BTC_100(ptr %a) {
78 ; CHECK-LABEL: 'test_distance_equal_BTC_100'
80 ; 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
81 ; CHECK-NEXT: Unknown data dependence.
82 ; CHECK-NEXT: Dependences:
83 ; CHECK-NEXT: Unknown:
84 ; CHECK-NEXT: %l = load i32, ptr %gep.x, align 4 ->
85 ; CHECK-NEXT: store i32 %l, ptr %gep, align 4
87 ; CHECK-NEXT: Run-time memory checks:
88 ; CHECK-NEXT: Grouped accesses:
90 ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
91 ; CHECK-NEXT: SCEV assumptions:
93 ; CHECK-NEXT: Expressions re-written:
96 %gep.x = getelementptr i32, ptr %a, i32 99
100 %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
101 %gep = getelementptr i32, ptr %a, i32 %iv
102 %l = load i32, ptr %gep.x
103 store i32 %l, ptr %gep
104 %iv.next = add i32 %iv, 1
105 %ec = icmp eq i32 %iv.next, 100
106 br i1 %ec, label %exit, label %loop
112 define void @test_distance_greater_than_BTC_10000(ptr %a) {
113 ; CHECK-LABEL: 'test_distance_greater_than_BTC_10000'
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: Unknown data dependence.
117 ; CHECK-NEXT: Dependences:
118 ; CHECK-NEXT: Unknown:
119 ; CHECK-NEXT: %l = load i32, ptr %gep.x, align 4 ->
120 ; CHECK-NEXT: store i32 %l, ptr %gep, 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:
131 %gep.x = getelementptr i32, ptr %a, i32 10000
135 %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
136 %gep = getelementptr i32, ptr %a, i32 %iv
137 %l = load i32, ptr %gep.x
138 store i32 %l, ptr %gep
139 %iv.next = add i32 %iv, 1
140 %ec = icmp eq i32 %iv.next, 10000
141 br i1 %ec, label %exit, label %loop
147 define void @test_distance_equal_to_BTC_10000(ptr %a) {
148 ; CHECK-LABEL: 'test_distance_equal_to_BTC_10000'
150 ; 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
151 ; CHECK-NEXT: Unknown data dependence.
152 ; CHECK-NEXT: Dependences:
153 ; CHECK-NEXT: Unknown:
154 ; CHECK-NEXT: %l = load i32, ptr %gep.x, align 4 ->
155 ; CHECK-NEXT: store i32 %l, ptr %gep, align 4
157 ; CHECK-NEXT: Run-time memory checks:
158 ; CHECK-NEXT: Grouped accesses:
160 ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
161 ; CHECK-NEXT: SCEV assumptions:
163 ; CHECK-NEXT: Expressions re-written:
166 %gep.x = getelementptr i32, ptr %a, i32 9999
170 %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
171 %gep = getelementptr i32, ptr %a, i32 %iv
172 %l = load i32, ptr %gep.x
173 store i32 %l, ptr %gep
174 %iv.next = add i32 %iv, 1
175 %ec = icmp eq i32 %iv.next, 100000
176 br i1 %ec, label %exit, label %loop
182 define void @test_btc_is_unknown_value(ptr %a, i32 %N) {
183 ; CHECK-LABEL: 'test_btc_is_unknown_value'
185 ; 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
186 ; CHECK-NEXT: Unknown data dependence.
187 ; CHECK-NEXT: Dependences:
188 ; CHECK-NEXT: Unknown:
189 ; CHECK-NEXT: %l = load i32, ptr %gep.x, align 4 ->
190 ; CHECK-NEXT: store i32 %l, ptr %gep, align 4
192 ; CHECK-NEXT: Run-time memory checks:
193 ; CHECK-NEXT: Grouped accesses:
194 ; CHECK-NEXT: Group [[GRP1:0x[0-9a-f]+]]:
195 ; CHECK-NEXT: (Low: (400 + %a) High: (404 + %a))
196 ; CHECK-NEXT: Member: (400 + %a)
197 ; CHECK-NEXT: Group [[GRP2:0x[0-9a-f]+]]:
198 ; CHECK-NEXT: (Low: %a High: (4 + (4 * (zext i32 (-1 + %N) to i64))<nuw><nsw> + %a))
199 ; CHECK-NEXT: Member: {%a,+,4}<nw><%loop>
201 ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
202 ; CHECK-NEXT: SCEV assumptions:
203 ; CHECK-NEXT: {0,+,1}<nuw><%loop> Added Flags: <nssw>
205 ; CHECK-NEXT: Expressions re-written:
206 ; CHECK-NEXT: [PSE] %gep = getelementptr i32, ptr %a, i32 %iv:
207 ; CHECK-NEXT: ((4 * (sext i32 {0,+,1}<nuw><%loop> to i64))<nsw> + %a)
208 ; CHECK-NEXT: --> {%a,+,4}<nw><%loop>
211 %gep.x = getelementptr i32, ptr %a, i32 100
215 %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
216 %gep = getelementptr i32, ptr %a, i32 %iv
217 %l = load i32, ptr %gep.x
218 store i32 %l, ptr %gep
219 %iv.next = add i32 %iv, 1
220 %ec = icmp eq i32 %iv.next, %N
221 br i1 %ec, label %exit, label %loop