1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S < %s -passes=slp-vectorizer -slp-max-reg-size=128 -slp-min-reg-size=128 | FileCheck %s
4 declare void @llvm.sideeffect()
6 ; SLP vectorization across a @llvm.sideeffect.
8 define void @test_sideeffect(ptr %p) {
9 ; CHECK-LABEL: @test_sideeffect(
10 ; CHECK-NEXT: call void @llvm.sideeffect()
11 ; CHECK-NEXT: call void @llvm.sideeffect()
12 ; CHECK-NEXT: [[TMP2:%.*]] = load <4 x float>, ptr [[P:%.*]], align 4
13 ; CHECK-NEXT: store <4 x float> [[TMP2]], ptr [[P]], align 4
14 ; CHECK-NEXT: ret void
16 %p1 = getelementptr float, ptr %p, i64 1
17 %p2 = getelementptr float, ptr %p, i64 2
18 %p3 = getelementptr float, ptr %p, i64 3
19 %l0 = load float, ptr %p
20 %l1 = load float, ptr %p1
21 %l2 = load float, ptr %p2
22 call void @llvm.sideeffect()
23 %l3 = load float, ptr %p3
24 store float %l0, ptr %p
25 call void @llvm.sideeffect()
26 store float %l1, ptr %p1
27 store float %l2, ptr %p2
28 store float %l3, ptr %p3
34 define void @test_inaccessiblememonly(ptr %p) {
35 ; CHECK-LABEL: @test_inaccessiblememonly(
36 ; CHECK-NEXT: call void @foo() #[[ATTR1:[0-9]+]]
37 ; CHECK-NEXT: call void @foo() #[[ATTR1]]
38 ; CHECK-NEXT: [[TMP2:%.*]] = load <4 x float>, ptr [[P:%.*]], align 4
39 ; CHECK-NEXT: store <4 x float> [[TMP2]], ptr [[P]], align 4
40 ; CHECK-NEXT: ret void
42 %p1 = getelementptr float, ptr %p, i64 1
43 %p2 = getelementptr float, ptr %p, i64 2
44 %p3 = getelementptr float, ptr %p, i64 3
45 %l0 = load float, ptr %p
46 %l1 = load float, ptr %p1
47 %l2 = load float, ptr %p2
48 call void @foo() inaccessiblememonly
49 %l3 = load float, ptr %p3
50 store float %l0, ptr %p
51 call void @foo() inaccessiblememonly
52 store float %l1, ptr %p1
53 store float %l2, ptr %p2
54 store float %l3, ptr %p3