1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -S < %s -slp-vectorizer -slp-max-reg-size=128 -slp-min-reg-size=128 | FileCheck %s
3
4declare void @llvm.sideeffect()
5
6; SLP vectorization across a @llvm.sideeffect.
7
8define void @test_sideeffect(float* %p) {
9; CHECK-LABEL: @test_sideeffect(
10; CHECK-NEXT:    [[P0:%.*]] = getelementptr float, float* [[P:%.*]], i64 0
11; CHECK-NEXT:    [[P1:%.*]] = getelementptr float, float* [[P]], i64 1
12; CHECK-NEXT:    [[P2:%.*]] = getelementptr float, float* [[P]], i64 2
13; CHECK-NEXT:    [[P3:%.*]] = getelementptr float, float* [[P]], i64 3
14; CHECK-NEXT:    call void @llvm.sideeffect()
15; CHECK-NEXT:    [[TMP1:%.*]] = bitcast float* [[P0]] to <4 x float>*
16; CHECK-NEXT:    [[TMP2:%.*]] = load <4 x float>, <4 x float>* [[TMP1]], align 4
17; CHECK-NEXT:    call void @llvm.sideeffect()
18; CHECK-NEXT:    [[TMP3:%.*]] = bitcast float* [[P0]] to <4 x float>*
19; CHECK-NEXT:    store <4 x float> [[TMP2]], <4 x float>* [[TMP3]], align 4
20; CHECK-NEXT:    ret void
21;
22  %p0 = getelementptr float, float* %p, i64 0
23  %p1 = getelementptr float, float* %p, i64 1
24  %p2 = getelementptr float, float* %p, i64 2
25  %p3 = getelementptr float, float* %p, i64 3
26  %l0 = load float, float* %p0
27  %l1 = load float, float* %p1
28  %l2 = load float, float* %p2
29  call void @llvm.sideeffect()
30  %l3 = load float, float* %p3
31  store float %l0, float* %p0
32  call void @llvm.sideeffect()
33  store float %l1, float* %p1
34  store float %l2, float* %p2
35  store float %l3, float* %p3
36  ret void
37}
38
39declare void @foo()
40
41define void @test_inaccessiblememonly(float* %p) {
42; CHECK-LABEL: @test_inaccessiblememonly(
43; CHECK-NEXT:    [[P0:%.*]] = getelementptr float, float* [[P:%.*]], i64 0
44; CHECK-NEXT:    [[P1:%.*]] = getelementptr float, float* [[P]], i64 1
45; CHECK-NEXT:    [[P2:%.*]] = getelementptr float, float* [[P]], i64 2
46; CHECK-NEXT:    [[P3:%.*]] = getelementptr float, float* [[P]], i64 3
47; CHECK-NEXT:    call void @foo() #[[ATTR1:[0-9]+]]
48; CHECK-NEXT:    [[TMP1:%.*]] = bitcast float* [[P0]] to <4 x float>*
49; CHECK-NEXT:    [[TMP2:%.*]] = load <4 x float>, <4 x float>* [[TMP1]], align 4
50; CHECK-NEXT:    call void @foo() #[[ATTR1]]
51; CHECK-NEXT:    [[TMP3:%.*]] = bitcast float* [[P0]] to <4 x float>*
52; CHECK-NEXT:    store <4 x float> [[TMP2]], <4 x float>* [[TMP3]], align 4
53; CHECK-NEXT:    ret void
54;
55  %p0 = getelementptr float, float* %p, i64 0
56  %p1 = getelementptr float, float* %p, i64 1
57  %p2 = getelementptr float, float* %p, i64 2
58  %p3 = getelementptr float, float* %p, i64 3
59  %l0 = load float, float* %p0
60  %l1 = load float, float* %p1
61  %l2 = load float, float* %p2
62  call void @foo() inaccessiblememonly
63  %l3 = load float, float* %p3
64  store float %l0, float* %p0
65  call void @foo() inaccessiblememonly
66  store float %l1, float* %p1
67  store float %l2, float* %p2
68  store float %l3, float* %p3
69  ret void
70}
71