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