Skip to content

Commit a94f081

Browse files
authored
LAA: regen a test with UTC (NFC) (#122748)
1 parent 40fa7f5 commit a94f081

File tree

1 file changed

+112
-64
lines changed

1 file changed

+112
-64
lines changed

llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll

Lines changed: 112 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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
44

55
; For this loop:
66
; unsigned index = 0;
@@ -19,24 +19,33 @@ target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
1919
; to check that the pointers don't wrap since the GEPs are not
2020
; inbound.
2121

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-
2822
; The expression for %mul_ext as analyzed by SCEV is
2923
; (zext i32 {0,+,2}<%for.body> to i64)
3024
; We have added the nusw flag to turn this expression into the SCEV expression:
3125
; i64 {0,+,2}<%for.body>
3226

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+
;
4049
entry:
4150
br label %for.body
4251

@@ -86,23 +95,33 @@ for.end: ; preds = %for.body
8695
; This loop has a negative stride for A, and the nusw flag is required in
8796
; order to properly extend the increment from i32 -4 to i64 -4.
8897

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-
9598
; The expression for %mul_ext as analyzed by SCEV is
9699
; (zext i32 {(2 * (trunc i64 %N to i32)),+,-2}<%for.body> to i64)
97100
; We have added the nusw flag to turn this expression into the following SCEV:
98101
; i64 {zext i32 (2 * (trunc i64 %N to i32)) to i64,+,-2}<%for.body>
99102

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+
;
106125
entry:
107126
%TruncN = trunc i64 %N to i32
108127
br label %for.body
@@ -137,23 +156,33 @@ for.end: ; preds = %for.body
137156
; We replicate the tests above, but this time sign extend 2 * index instead
138157
; of zero extending it.
139158

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-
146159
; The expression for %mul_ext as analyzed by SCEV is
147160
; i64 (sext i32 {0,+,2}<%for.body> to i64)
148161
; We have added the nssw flag to turn this expression into the following SCEV:
149162
; i64 {0,+,2}<%for.body>
150163

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+
;
157186
entry:
158187
br label %for.body
159188

@@ -184,23 +213,33 @@ for.end: ; preds = %for.body
184213
ret void
185214
}
186215

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-
193216
; The expression for %mul_ext as analyzed by SCEV is
194217
; i64 (sext i32 {(2 * (trunc i64 %N to i32)),+,-2}<%for.body> to i64)
195218
; We have added the nssw flag to turn this expression into the following SCEV:
196219
; i64 {sext i32 (2 * (trunc i64 %N to i32)) to i64,+,-2}<%for.body>
197220

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+
;
204243
entry:
205244
%TruncN = trunc i64 %N to i32
206245
br label %for.body
@@ -239,18 +278,27 @@ for.end: ; preds = %for.body
239278
;
240279
; We can still analyze this by adding the required no wrap SCEV predicates.
241280

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+
;
254302
entry:
255303
%TruncN = trunc i64 %N to i32
256304
br label %for.body

0 commit comments

Comments
 (0)