Skip to content

Commit dc37f53

Browse files
committed
[LoadStoreVectorizer] Add test for inaccessiblememonly call (NFC)
1 parent f9277ca commit dc37f53

File tree

1 file changed

+72
-19
lines changed

1 file changed

+72
-19
lines changed
Lines changed: 72 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,80 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
12
; RUN: opt -S < %s -load-store-vectorizer | FileCheck %s
23
; RUN: opt -S < %s -passes='function(load-store-vectorizer)' | FileCheck %s
34

45
declare void @llvm.sideeffect()
56

67
; load-store vectorization across a @llvm.sideeffect.
78

8-
; CHECK-LABEL: test
9-
; CHECK: load <4 x float>
10-
; CHECK: store <4 x float>
11-
define void @test(float* %p) {
12-
%p0 = getelementptr float, float* %p, i64 0
13-
%p1 = getelementptr float, float* %p, i64 1
14-
%p2 = getelementptr float, float* %p, i64 2
15-
%p3 = getelementptr float, float* %p, i64 3
16-
%l0 = load float, float* %p0, align 16
17-
%l1 = load float, float* %p1
18-
%l2 = load float, float* %p2
19-
call void @llvm.sideeffect()
20-
%l3 = load float, float* %p3
21-
store float %l0, float* %p0, align 16
22-
call void @llvm.sideeffect()
23-
store float %l1, float* %p1
24-
store float %l2, float* %p2
25-
store float %l3, float* %p3
26-
ret void
9+
define void @test_sideeffect(float* %p) {
10+
; CHECK-LABEL: @test_sideeffect(
11+
; CHECK-NEXT: [[P0:%.*]] = getelementptr float, float* [[P:%.*]], i64 0
12+
; CHECK-NEXT: [[TMP1:%.*]] = bitcast float* [[P0]] to <4 x float>*
13+
; CHECK-NEXT: [[TMP2:%.*]] = load <4 x float>, <4 x float>* [[TMP1]], align 16
14+
; CHECK-NEXT: [[L01:%.*]] = extractelement <4 x float> [[TMP2]], i32 0
15+
; CHECK-NEXT: [[L12:%.*]] = extractelement <4 x float> [[TMP2]], i32 1
16+
; CHECK-NEXT: [[L23:%.*]] = extractelement <4 x float> [[TMP2]], i32 2
17+
; CHECK-NEXT: [[L34:%.*]] = extractelement <4 x float> [[TMP2]], i32 3
18+
; CHECK-NEXT: call void @llvm.sideeffect()
19+
; CHECK-NEXT: call void @llvm.sideeffect()
20+
; CHECK-NEXT: [[TMP3:%.*]] = insertelement <4 x float> undef, float [[L01]], i32 0
21+
; CHECK-NEXT: [[TMP4:%.*]] = insertelement <4 x float> [[TMP3]], float [[L12]], i32 1
22+
; CHECK-NEXT: [[TMP5:%.*]] = insertelement <4 x float> [[TMP4]], float [[L23]], i32 2
23+
; CHECK-NEXT: [[TMP6:%.*]] = insertelement <4 x float> [[TMP5]], float [[L34]], i32 3
24+
; CHECK-NEXT: [[TMP7:%.*]] = bitcast float* [[P0]] to <4 x float>*
25+
; CHECK-NEXT: store <4 x float> [[TMP6]], <4 x float>* [[TMP7]], align 16
26+
; CHECK-NEXT: ret void
27+
;
28+
%p0 = getelementptr float, float* %p, i64 0
29+
%p1 = getelementptr float, float* %p, i64 1
30+
%p2 = getelementptr float, float* %p, i64 2
31+
%p3 = getelementptr float, float* %p, i64 3
32+
%l0 = load float, float* %p0, align 16
33+
%l1 = load float, float* %p1
34+
%l2 = load float, float* %p2
35+
call void @llvm.sideeffect()
36+
%l3 = load float, float* %p3
37+
store float %l0, float* %p0, align 16
38+
call void @llvm.sideeffect()
39+
store float %l1, float* %p1
40+
store float %l2, float* %p2
41+
store float %l3, float* %p3
42+
ret void
43+
}
44+
45+
declare void @foo()
46+
47+
define void @test_inaccessiblememonly(float* %p) {
48+
; CHECK-LABEL: @test_inaccessiblememonly(
49+
; CHECK-NEXT: [[P0:%.*]] = getelementptr float, float* [[P:%.*]], i64 0
50+
; CHECK-NEXT: [[P1:%.*]] = getelementptr float, float* [[P]], i64 1
51+
; CHECK-NEXT: [[P2:%.*]] = getelementptr float, float* [[P]], i64 2
52+
; CHECK-NEXT: [[P3:%.*]] = getelementptr float, float* [[P]], i64 3
53+
; CHECK-NEXT: [[L0:%.*]] = load float, float* [[P0]], align 16
54+
; CHECK-NEXT: [[L1:%.*]] = load float, float* [[P1]], align 4
55+
; CHECK-NEXT: [[L2:%.*]] = load float, float* [[P2]], align 4
56+
; CHECK-NEXT: call void @foo() #[[ATTR1:[0-9]+]]
57+
; CHECK-NEXT: [[L3:%.*]] = load float, float* [[P3]], align 4
58+
; CHECK-NEXT: store float [[L0]], float* [[P0]], align 16
59+
; CHECK-NEXT: call void @foo() #[[ATTR1]]
60+
; CHECK-NEXT: store float [[L1]], float* [[P1]], align 4
61+
; CHECK-NEXT: store float [[L2]], float* [[P2]], align 4
62+
; CHECK-NEXT: store float [[L3]], float* [[P3]], align 4
63+
; CHECK-NEXT: ret void
64+
;
65+
%p0 = getelementptr float, float* %p, i64 0
66+
%p1 = getelementptr float, float* %p, i64 1
67+
%p2 = getelementptr float, float* %p, i64 2
68+
%p3 = getelementptr float, float* %p, i64 3
69+
%l0 = load float, float* %p0, align 16
70+
%l1 = load float, float* %p1
71+
%l2 = load float, float* %p2
72+
call void @foo() inaccessiblememonly nounwind
73+
%l3 = load float, float* %p3
74+
store float %l0, float* %p0, align 16
75+
call void @foo() inaccessiblememonly nounwind
76+
store float %l1, float* %p1
77+
store float %l2, float* %p2
78+
store float %l3, float* %p3
79+
ret void
2780
}

0 commit comments

Comments
 (0)