1
- ; RUN: opt -passes='print<access-info>' -aa-pipeline='basic-aa' -disable-output < %s 2>&1 | FileCheck %s --check-prefix=LAA
2
-
3
- target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
1
+ ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 5
2
+ ; RUN: opt -passes='print<access-info>' -aa-pipeline='basic-aa' \
3
+ ; RUN: -disable-output %s 2>&1 | FileCheck %s
4
4
5
5
; For this loop:
6
6
; unsigned index = 0;
@@ -19,24 +19,33 @@ target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
19
19
; to check that the pointers don't wrap since the GEPs are not
20
20
; inbound.
21
21
22
- ; LAA-LABEL: f1
23
- ; LAA: Memory dependences are safe{{$}}
24
- ; LAA: SCEV assumptions:
25
- ; LAA: {0,+,2}<%for.body> Added Flags: <nusw>
26
- ; LAA-NEXT: {%a,+,4}<%for.body> Added Flags: <nusw>
27
-
28
22
; The expression for %mul_ext as analyzed by SCEV is
29
23
; (zext i32 {0,+,2}<%for.body> to i64)
30
24
; We have added the nusw flag to turn this expression into the SCEV expression:
31
25
; i64 {0,+,2}<%for.body>
32
26
33
- ; LAA: [PSE] %arrayidxA = getelementptr i16, ptr %a, i64 %mul_ext:
34
- ; LAA-NEXT: ((2 * (zext i32 {0,+,2}<%for.body> to i64))<nuw><nsw> + %a)
35
- ; LAA-NEXT: --> {%a,+,4}<%for.body>
36
-
37
-
38
- define void @f1 (ptr noalias %a ,
39
- ptr noalias %b , i64 %N ) {
27
+ define void @f1 (ptr noalias %a , ptr noalias %b , i64 %N ) {
28
+ ; CHECK-LABEL: 'f1'
29
+ ; CHECK-NEXT: for.body:
30
+ ; CHECK-NEXT: Memory dependences are safe
31
+ ; CHECK-NEXT: Dependences:
32
+ ; CHECK-NEXT: Forward:
33
+ ; CHECK-NEXT: %loadA = load i16, ptr %arrayidxA, align 2 ->
34
+ ; CHECK-NEXT: store i16 %add, ptr %arrayidxA, align 2
35
+ ; CHECK-EMPTY:
36
+ ; CHECK-NEXT: Run-time memory checks:
37
+ ; CHECK-NEXT: Grouped accesses:
38
+ ; CHECK-EMPTY:
39
+ ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
40
+ ; CHECK-NEXT: SCEV assumptions:
41
+ ; CHECK-NEXT: {0,+,2}<%for.body> Added Flags: <nusw>
42
+ ; CHECK-NEXT: {%a,+,4}<%for.body> Added Flags: <nusw>
43
+ ; CHECK-EMPTY:
44
+ ; CHECK-NEXT: Expressions re-written:
45
+ ; CHECK-NEXT: [PSE] %arrayidxA = getelementptr i16, ptr %a, i64 %mul_ext:
46
+ ; CHECK-NEXT: ((2 * (zext i32 {0,+,2}<%for.body> to i64))<nuw><nsw> + %a)
47
+ ; CHECK-NEXT: --> {%a,+,4}<%for.body>
48
+ ;
40
49
entry:
41
50
br label %for.body
42
51
@@ -86,23 +95,33 @@ for.end: ; preds = %for.body
86
95
; This loop has a negative stride for A, and the nusw flag is required in
87
96
; order to properly extend the increment from i32 -4 to i64 -4.
88
97
89
- ; LAA-LABEL: f2
90
- ; LAA: Memory dependences are safe{{$}}
91
- ; LAA: SCEV assumptions:
92
- ; LAA-NEXT: {(2 * (trunc i64 %N to i32)),+,-2}<%for.body> Added Flags: <nusw>
93
- ; LAA-NEXT: {((4 * (zext i31 (trunc i64 %N to i31) to i64))<nuw><nsw> + %a),+,-4}<%for.body> Added Flags: <nusw>
94
-
95
98
; The expression for %mul_ext as analyzed by SCEV is
96
99
; (zext i32 {(2 * (trunc i64 %N to i32)),+,-2}<%for.body> to i64)
97
100
; We have added the nusw flag to turn this expression into the following SCEV:
98
101
; i64 {zext i32 (2 * (trunc i64 %N to i32)) to i64,+,-2}<%for.body>
99
102
100
- ; LAA: [PSE] %arrayidxA = getelementptr i16, ptr %a, i64 %mul_ext:
101
- ; LAA-NEXT: ((2 * (zext i32 {(2 * (trunc i64 %N to i32)),+,-2}<%for.body> to i64))<nuw><nsw> + %a)
102
- ; LAA-NEXT: --> {((4 * (zext i31 (trunc i64 %N to i31) to i64))<nuw><nsw> + %a),+,-4}<%for.body>
103
-
104
- define void @f2 (ptr noalias %a ,
105
- ptr noalias %b , i64 %N ) {
103
+ define void @f2 (ptr noalias %a , ptr noalias %b , i64 %N ) {
104
+ ; CHECK-LABEL: 'f2'
105
+ ; CHECK-NEXT: for.body:
106
+ ; CHECK-NEXT: Memory dependences are safe
107
+ ; CHECK-NEXT: Dependences:
108
+ ; CHECK-NEXT: Forward:
109
+ ; CHECK-NEXT: %loadA = load i16, ptr %arrayidxA, align 2 ->
110
+ ; CHECK-NEXT: store i16 %add, ptr %arrayidxA, align 2
111
+ ; CHECK-EMPTY:
112
+ ; CHECK-NEXT: Run-time memory checks:
113
+ ; CHECK-NEXT: Grouped accesses:
114
+ ; CHECK-EMPTY:
115
+ ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
116
+ ; CHECK-NEXT: SCEV assumptions:
117
+ ; CHECK-NEXT: {(2 * (trunc i64 %N to i32)),+,-2}<%for.body> Added Flags: <nusw>
118
+ ; CHECK-NEXT: {((4 * (zext i31 (trunc i64 %N to i31) to i64))<nuw><nsw> + %a),+,-4}<%for.body> Added Flags: <nusw>
119
+ ; CHECK-EMPTY:
120
+ ; CHECK-NEXT: Expressions re-written:
121
+ ; CHECK-NEXT: [PSE] %arrayidxA = getelementptr i16, ptr %a, i64 %mul_ext:
122
+ ; CHECK-NEXT: ((2 * (zext i32 {(2 * (trunc i64 %N to i32)),+,-2}<%for.body> to i64))<nuw><nsw> + %a)
123
+ ; CHECK-NEXT: --> {((4 * (zext i31 (trunc i64 %N to i31) to i64))<nuw><nsw> + %a),+,-4}<%for.body>
124
+ ;
106
125
entry:
107
126
%TruncN = trunc i64 %N to i32
108
127
br label %for.body
@@ -137,23 +156,33 @@ for.end: ; preds = %for.body
137
156
; We replicate the tests above, but this time sign extend 2 * index instead
138
157
; of zero extending it.
139
158
140
- ; LAA-LABEL: f3
141
- ; LAA: Memory dependences are safe{{$}}
142
- ; LAA: SCEV assumptions:
143
- ; LAA-NEXT: {0,+,2}<%for.body> Added Flags: <nssw>
144
- ; LAA-NEXT: {%a,+,4}<%for.body> Added Flags: <nusw>
145
-
146
159
; The expression for %mul_ext as analyzed by SCEV is
147
160
; i64 (sext i32 {0,+,2}<%for.body> to i64)
148
161
; We have added the nssw flag to turn this expression into the following SCEV:
149
162
; i64 {0,+,2}<%for.body>
150
163
151
- ; LAA: [PSE] %arrayidxA = getelementptr i16, ptr %a, i64 %mul_ext:
152
- ; LAA-NEXT: ((2 * (sext i32 {0,+,2}<%for.body> to i64))<nsw> + %a)
153
- ; LAA-NEXT: --> {%a,+,4}<%for.body>
154
-
155
- define void @f3 (ptr noalias %a ,
156
- ptr noalias %b , i64 %N ) {
164
+ define void @f3 (ptr noalias %a , ptr noalias %b , i64 %N ) {
165
+ ; CHECK-LABEL: 'f3'
166
+ ; CHECK-NEXT: for.body:
167
+ ; CHECK-NEXT: Memory dependences are safe
168
+ ; CHECK-NEXT: Dependences:
169
+ ; CHECK-NEXT: Forward:
170
+ ; CHECK-NEXT: %loadA = load i16, ptr %arrayidxA, align 2 ->
171
+ ; CHECK-NEXT: store i16 %add, ptr %arrayidxA, align 2
172
+ ; CHECK-EMPTY:
173
+ ; CHECK-NEXT: Run-time memory checks:
174
+ ; CHECK-NEXT: Grouped accesses:
175
+ ; CHECK-EMPTY:
176
+ ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
177
+ ; CHECK-NEXT: SCEV assumptions:
178
+ ; CHECK-NEXT: {0,+,2}<%for.body> Added Flags: <nssw>
179
+ ; CHECK-NEXT: {%a,+,4}<%for.body> Added Flags: <nusw>
180
+ ; CHECK-EMPTY:
181
+ ; CHECK-NEXT: Expressions re-written:
182
+ ; CHECK-NEXT: [PSE] %arrayidxA = getelementptr i16, ptr %a, i64 %mul_ext:
183
+ ; CHECK-NEXT: ((2 * (sext i32 {0,+,2}<%for.body> to i64))<nsw> + %a)
184
+ ; CHECK-NEXT: --> {%a,+,4}<%for.body>
185
+ ;
157
186
entry:
158
187
br label %for.body
159
188
@@ -184,23 +213,33 @@ for.end: ; preds = %for.body
184
213
ret void
185
214
}
186
215
187
- ; LAA-LABEL: f4
188
- ; LAA: Memory dependences are safe{{$}}
189
- ; LAA: SCEV assumptions:
190
- ; LAA-NEXT: {(2 * (trunc i64 %N to i32)),+,-2}<%for.body> Added Flags: <nssw>
191
- ; LAA-NEXT: {((2 * (sext i32 (2 * (trunc i64 %N to i32)) to i64))<nsw> + %a),+,-4}<%for.body> Added Flags: <nusw>
192
-
193
216
; The expression for %mul_ext as analyzed by SCEV is
194
217
; i64 (sext i32 {(2 * (trunc i64 %N to i32)),+,-2}<%for.body> to i64)
195
218
; We have added the nssw flag to turn this expression into the following SCEV:
196
219
; i64 {sext i32 (2 * (trunc i64 %N to i32)) to i64,+,-2}<%for.body>
197
220
198
- ; LAA: [PSE] %arrayidxA = getelementptr i16, ptr %a, i64 %mul_ext:
199
- ; LAA-NEXT: ((2 * (sext i32 {(2 * (trunc i64 %N to i32)),+,-2}<%for.body> to i64))<nsw> + %a)
200
- ; LAA-NEXT: --> {((2 * (sext i32 (2 * (trunc i64 %N to i32)) to i64))<nsw> + %a),+,-4}<%for.body>
201
-
202
- define void @f4 (ptr noalias %a ,
203
- ptr noalias %b , i64 %N ) {
221
+ define void @f4 (ptr noalias %a , ptr noalias %b , i64 %N ) {
222
+ ; CHECK-LABEL: 'f4'
223
+ ; CHECK-NEXT: for.body:
224
+ ; CHECK-NEXT: Memory dependences are safe
225
+ ; CHECK-NEXT: Dependences:
226
+ ; CHECK-NEXT: Forward:
227
+ ; CHECK-NEXT: %loadA = load i16, ptr %arrayidxA, align 2 ->
228
+ ; CHECK-NEXT: store i16 %add, ptr %arrayidxA, align 2
229
+ ; CHECK-EMPTY:
230
+ ; CHECK-NEXT: Run-time memory checks:
231
+ ; CHECK-NEXT: Grouped accesses:
232
+ ; CHECK-EMPTY:
233
+ ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
234
+ ; CHECK-NEXT: SCEV assumptions:
235
+ ; CHECK-NEXT: {(2 * (trunc i64 %N to i32)),+,-2}<%for.body> Added Flags: <nssw>
236
+ ; CHECK-NEXT: {((2 * (sext i32 (2 * (trunc i64 %N to i32)) to i64))<nsw> + %a),+,-4}<%for.body> Added Flags: <nusw>
237
+ ; CHECK-EMPTY:
238
+ ; CHECK-NEXT: Expressions re-written:
239
+ ; CHECK-NEXT: [PSE] %arrayidxA = getelementptr i16, ptr %a, i64 %mul_ext:
240
+ ; CHECK-NEXT: ((2 * (sext i32 {(2 * (trunc i64 %N to i32)),+,-2}<%for.body> to i64))<nsw> + %a)
241
+ ; CHECK-NEXT: --> {((2 * (sext i32 (2 * (trunc i64 %N to i32)) to i64))<nsw> + %a),+,-4}<%for.body>
242
+ ;
204
243
entry:
205
244
%TruncN = trunc i64 %N to i32
206
245
br label %for.body
@@ -239,18 +278,27 @@ for.end: ; preds = %for.body
239
278
;
240
279
; We can still analyze this by adding the required no wrap SCEV predicates.
241
280
242
- ; LAA-LABEL: f5
243
- ; LAA: Memory dependences are safe{{$}}
244
- ; LAA: SCEV assumptions:
245
- ; LAA-NEXT: {(2 * (trunc i64 %N to i32)),+,-2}<%for.body> Added Flags: <nssw>
246
- ; LAA-EMPTY:
247
-
248
- ; LAA: [PSE] %arrayidxA = getelementptr inbounds i16, ptr %a, i32 %mul:
249
- ; LAA-NEXT: ((2 * (sext i32 {(2 * (trunc i64 %N to i32)),+,-2}<%for.body> to i64))<nsw> + %a)
250
- ; LAA-NEXT: --> {((2 * (sext i32 (2 * (trunc i64 %N to i32)) to i64))<nsw> + %a),+,-4}<%for.body>
251
-
252
- define void @f5 (ptr noalias %a ,
253
- ptr noalias %b , i64 %N ) {
281
+ define void @f5 (ptr noalias %a , ptr noalias %b , i64 %N ) {
282
+ ; CHECK-LABEL: 'f5'
283
+ ; CHECK-NEXT: for.body:
284
+ ; CHECK-NEXT: Memory dependences are safe
285
+ ; CHECK-NEXT: Dependences:
286
+ ; CHECK-NEXT: Forward:
287
+ ; CHECK-NEXT: %loadA = load i16, ptr %arrayidxA, align 2 ->
288
+ ; CHECK-NEXT: store i16 %add, ptr %arrayidxA, align 2
289
+ ; CHECK-EMPTY:
290
+ ; CHECK-NEXT: Run-time memory checks:
291
+ ; CHECK-NEXT: Grouped accesses:
292
+ ; CHECK-EMPTY:
293
+ ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
294
+ ; CHECK-NEXT: SCEV assumptions:
295
+ ; CHECK-NEXT: {(2 * (trunc i64 %N to i32)),+,-2}<%for.body> Added Flags: <nssw>
296
+ ; CHECK-EMPTY:
297
+ ; CHECK-NEXT: Expressions re-written:
298
+ ; CHECK-NEXT: [PSE] %arrayidxA = getelementptr inbounds i16, ptr %a, i32 %mul:
299
+ ; CHECK-NEXT: ((2 * (sext i32 {(2 * (trunc i64 %N to i32)),+,-2}<%for.body> to i64))<nsw> + %a)
300
+ ; CHECK-NEXT: --> {((2 * (sext i32 (2 * (trunc i64 %N to i32)) to i64))<nsw> + %a),+,-4}<%for.body>
301
+ ;
254
302
entry:
255
303
%TruncN = trunc i64 %N to i32
256
304
br label %for.body
0 commit comments