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: Memory dependences are safe
11 ; CHECK-NEXT: Dependences:
12 ; CHECK-NEXT: Run-time memory checks:
13 ; CHECK-NEXT: Grouped accesses:
15 ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
16 ; CHECK-NEXT: SCEV assumptions:
18 ; CHECK-NEXT: Expressions re-written:
21 %gep.x = getelementptr i32, ptr %a, i32 100
25 %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
26 %gep = getelementptr i32, ptr %a, i32 %iv
27 %l = load i32, ptr %gep.x
28 store i32 %l, ptr %gep
29 %iv.next = add i32 %iv, 1
30 %ec = icmp eq i32 %iv.next, 100
31 br i1 %ec, label %exit, label %loop
37 define void @test_distance_much_greater_than_BTC_100(ptr %a) {
38 ; CHECK-LABEL: 'test_distance_much_greater_than_BTC_100'
40 ; 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
41 ; CHECK-NEXT: Unknown data dependence.
42 ; CHECK-NEXT: Dependences:
43 ; CHECK-NEXT: Unknown:
44 ; CHECK-NEXT: %l = load i32, ptr %gep.x, align 4 ->
45 ; CHECK-NEXT: store i32 %l, ptr %gep, align 4
47 ; CHECK-NEXT: Run-time memory checks:
48 ; CHECK-NEXT: Grouped accesses:
50 ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
51 ; CHECK-NEXT: SCEV assumptions:
53 ; CHECK-NEXT: Expressions re-written:
56 %gep.x = getelementptr i32, ptr %a, i32 200
60 %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
61 %gep = getelementptr i32, ptr %a, i32 %iv
62 %l = load i32, ptr %gep.x
63 store i32 %l, ptr %gep
64 %iv.next = add i32 %iv, 1
65 %ec = icmp eq i32 %iv.next, 100
66 br i1 %ec, label %exit, label %loop
72 define void @test_distance_equal_BTC_100(ptr %a) {
73 ; CHECK-LABEL: 'test_distance_equal_BTC_100'
75 ; 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
76 ; CHECK-NEXT: Unknown data dependence.
77 ; CHECK-NEXT: Dependences:
78 ; CHECK-NEXT: Unknown:
79 ; CHECK-NEXT: %l = load i32, ptr %gep.x, align 4 ->
80 ; CHECK-NEXT: store i32 %l, ptr %gep, align 4
82 ; CHECK-NEXT: Run-time memory checks:
83 ; CHECK-NEXT: Grouped accesses:
85 ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
86 ; CHECK-NEXT: SCEV assumptions:
88 ; CHECK-NEXT: Expressions re-written:
91 %gep.x = getelementptr i32, ptr %a, i32 99
95 %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
96 %gep = getelementptr i32, ptr %a, i32 %iv
97 %l = load i32, ptr %gep.x
98 store i32 %l, ptr %gep
99 %iv.next = add i32 %iv, 1
100 %ec = icmp eq i32 %iv.next, 100
101 br i1 %ec, label %exit, label %loop
107 define void @test_distance_greater_than_BTC_10000(ptr %a) {
108 ; CHECK-LABEL: 'test_distance_greater_than_BTC_10000'
110 ; CHECK-NEXT: Memory dependences are safe
111 ; CHECK-NEXT: Dependences:
112 ; CHECK-NEXT: Run-time memory checks:
113 ; CHECK-NEXT: Grouped accesses:
115 ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
116 ; CHECK-NEXT: SCEV assumptions:
118 ; CHECK-NEXT: Expressions re-written:
121 %gep.x = getelementptr i32, ptr %a, i32 10000
125 %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
126 %gep = getelementptr i32, ptr %a, i32 %iv
127 %l = load i32, ptr %gep.x
128 store i32 %l, ptr %gep
129 %iv.next = add i32 %iv, 1
130 %ec = icmp eq i32 %iv.next, 10000
131 br i1 %ec, label %exit, label %loop
137 define void @test_distance_equal_to_BTC_10000(ptr %a) {
138 ; CHECK-LABEL: 'test_distance_equal_to_BTC_10000'
140 ; 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
141 ; CHECK-NEXT: Unknown data dependence.
142 ; CHECK-NEXT: Dependences:
143 ; CHECK-NEXT: Unknown:
144 ; CHECK-NEXT: %l = load i32, ptr %gep.x, align 4 ->
145 ; CHECK-NEXT: store i32 %l, ptr %gep, align 4
147 ; CHECK-NEXT: Run-time memory checks:
148 ; CHECK-NEXT: Grouped accesses:
150 ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
151 ; CHECK-NEXT: SCEV assumptions:
153 ; CHECK-NEXT: Expressions re-written:
156 %gep.x = getelementptr i32, ptr %a, i32 9999
160 %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
161 %gep = getelementptr i32, ptr %a, i32 %iv
162 %l = load i32, ptr %gep.x
163 store i32 %l, ptr %gep
164 %iv.next = add i32 %iv, 1
165 %ec = icmp eq i32 %iv.next, 100000
166 br i1 %ec, label %exit, label %loop
172 define void @test_btc_is_unknown_value(ptr %a, i32 %N) {
173 ; CHECK-LABEL: 'test_btc_is_unknown_value'
175 ; 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
176 ; CHECK-NEXT: Unknown data dependence.
177 ; CHECK-NEXT: Dependences:
178 ; CHECK-NEXT: Unknown:
179 ; CHECK-NEXT: %l = load i32, ptr %gep.x, align 4 ->
180 ; CHECK-NEXT: store i32 %l, ptr %gep, align 4
182 ; CHECK-NEXT: Run-time memory checks:
183 ; CHECK-NEXT: Grouped accesses:
184 ; CHECK-NEXT: Group [[GRP1:0x[0-9a-f]+]]:
185 ; CHECK-NEXT: (Low: (400 + %a) High: (404 + %a))
186 ; CHECK-NEXT: Member: (400 + %a)
187 ; CHECK-NEXT: Group [[GRP2:0x[0-9a-f]+]]:
188 ; CHECK-NEXT: (Low: %a High: (4 + (4 * (zext i32 (-1 + %N) to i64))<nuw><nsw> + %a))
189 ; CHECK-NEXT: Member: {%a,+,4}<nw><%loop>
191 ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
192 ; CHECK-NEXT: SCEV assumptions:
193 ; CHECK-NEXT: {0,+,1}<nuw><%loop> Added Flags: <nssw>
195 ; CHECK-NEXT: Expressions re-written:
196 ; CHECK-NEXT: [PSE] %gep = getelementptr i32, ptr %a, i32 %iv:
197 ; CHECK-NEXT: ((4 * (sext i32 {0,+,1}<nuw><%loop> to i64))<nsw> + %a)
198 ; CHECK-NEXT: --> {%a,+,4}<nw><%loop>
201 %gep.x = getelementptr i32, ptr %a, i32 100
205 %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
206 %gep = getelementptr i32, ptr %a, i32 %iv
207 %l = load i32, ptr %gep.x
208 store i32 %l, ptr %gep
209 %iv.next = add i32 %iv, 1
210 %ec = icmp eq i32 %iv.next, %N
211 br i1 %ec, label %exit, label %loop