1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=slp-vectorizer -slp-vectorize-hor -slp-vectorize-hor-store -S < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s
4 define void @test(ptr %ptr, ptr noalias %s) {
7 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq ptr [[PTR:%.*]], null
8 ; CHECK-NEXT: br i1 [[CMP]], label [[LOOP:%.*]], label [[BAIL_OUT:%.*]]
10 ; CHECK-NEXT: [[TMP1:%.*]] = load <4 x i32>, ptr [[PTR]], align 4
11 ; CHECK-NEXT: store <4 x i32> [[TMP1]], ptr [[S:%.*]], align 4
12 ; CHECK-NEXT: [[TMP3:%.*]] = extractelement <4 x i32> [[TMP1]], i32 0
13 ; CHECK-NEXT: br label [[LOOP1:%.*]]
15 ; CHECK-NEXT: store i32 [[TMP3]], ptr [[S]], align 4
16 ; CHECK-NEXT: br i1 true, label [[LOOP1]], label [[CONT:%.*]]
18 ; CHECK-NEXT: br i1 true, label [[LOOP]], label [[BAIL_OUT]]
20 ; CHECK-NEXT: [[DUMMY_PHI:%.*]] = phi i32 [ 1, [[ENTRY:%.*]] ], [ [[TMP3]], [[CONT]] ]
21 ; CHECK-NEXT: store i32 [[DUMMY_PHI]], ptr [[S]], align 4
22 ; CHECK-NEXT: ret void
25 %cmp = icmp eq ptr %ptr, null
26 br i1 %cmp, label %loop, label %bail_out
29 %0 = load i32, ptr %ptr , align 4
30 %1 = getelementptr inbounds i32, ptr %ptr, i64 1
31 %2 = load i32, ptr %1 , align 4
32 %3 = getelementptr inbounds i32, ptr %ptr, i64 2
33 %4 = load i32, ptr %3 , align 4
34 %5 = getelementptr inbounds i32, ptr %ptr, i64 3
35 %6 = load i32, ptr %5 , align 4
36 store i32 %0, ptr %s, align 4
37 %7 = getelementptr inbounds i32, ptr %s, i64 1
38 store i32 %2, ptr %7, align 4
39 %8 = getelementptr inbounds i32, ptr %s, i64 2
40 store i32 %4, ptr %8, align 4
41 %9 = getelementptr inbounds i32, ptr %s, i64 3
42 store i32 %6, ptr %9, align 4
46 store i32 %0, ptr %s, align 4
47 br i1 true, label %loop1, label %cont
50 br i1 true, label %loop, label %bail_out
53 %dummy_phi = phi i32 [ 1, %entry ], [ %0, %cont ]
54 store i32 %dummy_phi, ptr %s, align 4