1 ; RUN: opt -module-summary %s -o %t1.bc
3 ; Test SLP and Loop Vectorization are enabled by default at O2 and O3.
4 ; RUN: llvm-lto2 run %t1.bc -o %t2.o -O0 -r %t1.bc,foo,plx -debug-pass-manager \
5 ; RUN: -save-temps 2>&1 | FileCheck %s --check-prefix=CHECK-O0-SLP
6 ; RUN: llvm-dis %t2.o.1.4.opt.bc -o - | FileCheck %s --check-prefix=CHECK-O0-LPV
8 ; RUN: llvm-lto2 run %t1.bc -o %t3.o -O1 -r %t1.bc,foo,plx -debug-pass-manager \
9 ; RUN: -save-temps 2>&1 | FileCheck %s --check-prefix=CHECK-O1-SLP
10 ; RUN: llvm-dis %t3.o.1.4.opt.bc -o - | FileCheck %s --check-prefix=CHECK-O1-LPV
12 ; RUN: llvm-lto2 run %t1.bc -o %t4.o -O2 -r %t1.bc,foo,plx -debug-pass-manager \
13 ; RUN: -save-temps 2>&1 | FileCheck %s --check-prefix=CHECK-O2-SLP
14 ; RUN: llvm-dis %t4.o.1.4.opt.bc -o - | FileCheck %s --check-prefix=CHECK-O2-LPV
16 ; RUN: llvm-lto2 run %t1.bc -o %t5.o -O3 -r %t1.bc,foo,plx -debug-pass-manager \
17 ; RUN: -save-temps 2>&1 | FileCheck %s --check-prefix=CHECK-O3-SLP
18 ; RUN: llvm-dis %t5.o.1.4.opt.bc -o - | FileCheck %s --check-prefix=CHECK-O3-LPV
20 ; CHECK-O0-SLP-NOT: Running pass: SLPVectorizerPass
21 ; CHECK-O1-SLP-NOT: Running pass: SLPVectorizerPass
22 ; CHECK-O2-SLP: Running pass: SLPVectorizerPass
23 ; CHECK-O3-SLP: Running pass: SLPVectorizerPass
24 ; CHECK-O0-LPV-NOT: = !{!"llvm.loop.isvectorized", i32 1}
25 ; CHECK-O1-LPV-NOT: = !{!"llvm.loop.isvectorized", i32 1}
26 ; CHECK-O2-LPV: = !{!"llvm.loop.isvectorized", i32 1}
27 ; CHECK-O3-LPV: = !{!"llvm.loop.isvectorized", i32 1}
29 target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
30 target triple = "x86_64-unknown-linux-gnu"
32 define i32 @foo(ptr %a) {
37 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
38 %red.05 = phi i32 [ 0, %entry ], [ %add, %for.body ]
39 %arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
40 %0 = load i32, ptr %arrayidx, align 4
41 %add = add nsw i32 %0, %red.05
42 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
43 %exitcond = icmp eq i64 %indvars.iv.next, 255
44 br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !0
50 !0 = distinct !{!0, !1}
51 !1 = !{!"llvm.loop.unroll.disable", i1 true}