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:    call void @llvm.sideeffect()
12; CHECK-NEXT:    call void @llvm.sideeffect()
13; CHECK-NEXT:    [[TMP1:%.*]] = bitcast float* [[P0]] to <4 x float>*
14; CHECK-NEXT:    [[TMP2:%.*]] = load <4 x float>, <4 x float>* [[TMP1]], align 4
15; CHECK-NEXT:    [[TMP3:%.*]] = bitcast float* [[P0]] to <4 x float>*
16; CHECK-NEXT:    store <4 x float> [[TMP2]], <4 x float>* [[TMP3]], align 4
17; CHECK-NEXT:    ret void
18;
19  %p0 = getelementptr float, float* %p, i64 0
20  %p1 = getelementptr float, float* %p, i64 1
21  %p2 = getelementptr float, float* %p, i64 2
22  %p3 = getelementptr float, float* %p, i64 3
23  %l0 = load float, float* %p0
24  %l1 = load float, float* %p1
25  %l2 = load float, float* %p2
26  call void @llvm.sideeffect()
27  %l3 = load float, float* %p3
28  store float %l0, float* %p0
29  call void @llvm.sideeffect()
30  store float %l1, float* %p1
31  store float %l2, float* %p2
32  store float %l3, float* %p3
33  ret void
34}
35
36declare void @foo()
37
38define void @test_inaccessiblememonly(float* %p) {
39; CHECK-LABEL: @test_inaccessiblememonly(
40; CHECK-NEXT:    [[P0:%.*]] = getelementptr float, float* [[P:%.*]], i64 0
41; CHECK-NEXT:    call void @foo() #[[ATTR1:[0-9]+]]
42; CHECK-NEXT:    call void @foo() #[[ATTR1]]
43; CHECK-NEXT:    [[TMP1:%.*]] = bitcast float* [[P0]] to <4 x float>*
44; CHECK-NEXT:    [[TMP2:%.*]] = load <4 x float>, <4 x float>* [[TMP1]], align 4
45; CHECK-NEXT:    [[TMP3:%.*]] = bitcast float* [[P0]] to <4 x float>*
46; CHECK-NEXT:    store <4 x float> [[TMP2]], <4 x float>* [[TMP3]], align 4
47; CHECK-NEXT:    ret void
48;
49  %p0 = getelementptr float, float* %p, i64 0
50  %p1 = getelementptr float, float* %p, i64 1
51  %p2 = getelementptr float, float* %p, i64 2
52  %p3 = getelementptr float, float* %p, i64 3
53  %l0 = load float, float* %p0
54  %l1 = load float, float* %p1
55  %l2 = load float, float* %p2
56  call void @foo() inaccessiblememonly
57  %l3 = load float, float* %p3
58  store float %l0, float* %p0
59  call void @foo() inaccessiblememonly
60  store float %l1, float* %p1
61  store float %l2, float* %p2
62  store float %l3, float* %p3
63  ret void
64}
65