1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=slp-vectorizer -slp-threshold=-999 -mtriple=x86_64-unknown-linux-gnu -mcpu=skylake -S < %s | FileCheck %s
4 ; The test checks that loads should not be moved below a stackrestore boundary.
5 define void @stackrestore1(ptr %out) {
6 ; CHECK-LABEL: @stackrestore1(
7 ; CHECK-NEXT: [[STACK:%.*]] = call ptr @llvm.stacksave.p0()
8 ; CHECK-NEXT: [[LOCAL_ALLOCA:%.*]] = alloca [16 x i8], align 4
9 ; CHECK-NEXT: store <4 x float> <float 0x3FF3333340000000, float 0x3FF3333340000000, float 0x3FF3333340000000, float 0x3FF3333340000000>, ptr [[LOCAL_ALLOCA]], align 4
10 ; CHECK-NEXT: [[TMP1:%.*]] = load <4 x float>, ptr [[LOCAL_ALLOCA]], align 4
11 ; CHECK-NEXT: call void @llvm.stackrestore.p0(ptr [[STACK]])
12 ; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <4 x float> [[TMP1]], <4 x float> poison, <4 x i32> <i32 2, i32 3, i32 0, i32 1>
13 ; CHECK-NEXT: store <4 x float> [[TMP2]], ptr [[OUT:%.*]], align 4
14 ; CHECK-NEXT: ret void
16 %stack = call ptr @llvm.stacksave()
17 %local_alloca = alloca [16 x i8], align 4
18 store float 0x3FF3333340000000, ptr %local_alloca, align 4
19 %addr1 = getelementptr inbounds i8, ptr %local_alloca, i64 4
20 store float 0x3FF3333340000000, ptr %addr1, align 4
21 %addr2 = getelementptr inbounds i8, ptr %local_alloca, i64 8
22 store float 0x3FF3333340000000, ptr %addr2, align 4
23 %addr3 = getelementptr inbounds i8, ptr %local_alloca, i64 12
24 store float 0x3FF3333340000000, ptr %addr3, align 4
25 %val0 = load float, ptr %local_alloca, align 4
26 %val1 = load float, ptr %addr1, align 4
27 %val2 = load float, ptr %addr2, align 4
28 %val3 = load float, ptr %addr3, align 4
29 call void @llvm.stackrestore(ptr %stack)
30 %outaddr2 = getelementptr inbounds float, ptr %out, i64 2
31 store float %val0, ptr %outaddr2, align 4
32 %outaddr3 = getelementptr inbounds float, ptr %out, i64 3
33 store float %val1, ptr %outaddr3, align 4
34 store float %val2, ptr %out
35 %outaddr1 = getelementptr inbounds float, ptr %out, i64 1
36 store float %val3, ptr %outaddr1, align 4
40 declare ptr @llvm.stacksave()
41 declare void @llvm.stackrestore(ptr)