| 1 |
; RUN: opt -module-summary %s -o %t.o |
| 2 |
|
| 3 |
; Test SLP and Loop Vectorization are enabled by default at O2 and O3. |
| 4 |
; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \ |
| 5 |
; RUN: --plugin-opt=thinlto \ |
| 6 |
; RUN: --plugin-opt=new-pass-manager \ |
| 7 |
; RUN: --plugin-opt=debug-pass-manager \ |
| 8 |
; RUN: --plugin-opt=cache-dir=%t.cache \ |
| 9 |
; RUN: --plugin-opt=O0 \ |
| 10 |
; RUN: --plugin-opt=save-temps \ |
| 11 |
; RUN: -shared \ |
| 12 |
; RUN: -o %t2.o %t.o 2>&1 | FileCheck %s --check-prefix=CHECK-O0-SLP |
| 13 |
; RUN: llvm-dis %t.o.4.opt.bc -o - | FileCheck %s --check-prefix=CHECK-O0-LPV |
| 14 |
|
| 15 |
; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \ |
| 16 |
; RUN: --plugin-opt=thinlto \ |
| 17 |
; RUN: --plugin-opt=new-pass-manager \ |
| 18 |
; RUN: --plugin-opt=debug-pass-manager \ |
| 19 |
; RUN: --plugin-opt=cache-dir=%t.cache \ |
| 20 |
; RUN: --plugin-opt=O1 \ |
| 21 |
; RUN: --plugin-opt=save-temps \ |
| 22 |
; RUN: -shared \ |
| 23 |
; RUN: -o %t3.o %t.o 2>&1 | FileCheck %s --check-prefix=CHECK-O1-SLP |
| 24 |
; RUN: llvm-dis %t.o.4.opt.bc -o - | FileCheck %s --check-prefix=CHECK-O1-LPV |
| 25 |
|
| 26 |
; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \ |
| 27 |
; RUN: --plugin-opt=thinlto \ |
| 28 |
; RUN: --plugin-opt=new-pass-manager \ |
| 29 |
; RUN: --plugin-opt=debug-pass-manager \ |
| 30 |
; RUN: --plugin-opt=cache-dir=%t.cache \ |
| 31 |
; RUN: --plugin-opt=O2 \ |
| 32 |
; RUN: --plugin-opt=save-temps \ |
| 33 |
; RUN: -shared \ |
| 34 |
; RUN: -o %t4.o %t.o 2>&1 | FileCheck %s --check-prefix=CHECK-O2-SLP |
| 35 |
; RUN: llvm-dis %t.o.4.opt.bc -o - | FileCheck %s --check-prefix=CHECK-O2-LPV |
| 36 |
|
| 37 |
; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \ |
| 38 |
; RUN: --plugin-opt=thinlto \ |
| 39 |
; RUN: --plugin-opt=new-pass-manager \ |
| 40 |
; RUN: --plugin-opt=debug-pass-manager \ |
| 41 |
; RUN: --plugin-opt=cache-dir=%t.cache \ |
| 42 |
; RUN: --plugin-opt=O3 \ |
| 43 |
; RUN: --plugin-opt=save-temps \ |
| 44 |
; RUN: -shared \ |
| 45 |
; RUN: -o %t5.o %t.o 2>&1 | FileCheck %s --check-prefix=CHECK-O3-SLP |
| 46 |
; RUN: llvm-dis %t.o.4.opt.bc -o - | FileCheck %s --check-prefix=CHECK-O3-LPV |
| 47 |
|
| 48 |
; CHECK-O0-SLP-NOT: Running pass: SLPVectorizerPass |
| 49 |
; CHECK-O1-SLP-NOT: Running pass: SLPVectorizerPass |
| 50 |
; CHECK-O2-SLP: Running pass: SLPVectorizerPass |
| 51 |
; CHECK-O3-SLP: Running pass: SLPVectorizerPass |
| 52 |
; CHECK-O0-LPV-NOT: = !{!"llvm.loop.isvectorized", i32 1} |
| 53 |
; CHECK-O1-LPV-NOT: = !{!"llvm.loop.isvectorized", i32 1} |
| 54 |
; CHECK-O2-LPV: = !{!"llvm.loop.isvectorized", i32 1} |
| 55 |
; CHECK-O3-LPV: = !{!"llvm.loop.isvectorized", i32 1} |
| 56 |
|
| 57 |
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
| 58 |
target triple = "x86_64-unknown-linux-gnu" |
| 59 |
|
| 60 |
define i32 @foo(ptr %a) { |
| 61 |
entry: |
| 62 |
br label %for.body |
| 63 |
|
| 64 |
for.body: |
| 65 |
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] |
| 66 |
%red.05 = phi i32 [ 0, %entry ], [ %add, %for.body ] |
| 67 |
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv |
| 68 |
%0 = load i32, ptr %arrayidx, align 4 |
| 69 |
%add = add nsw i32 %0, %red.05 |
| 70 |
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 |
| 71 |
%exitcond = icmp eq i64 %indvars.iv.next, 255 |
| 72 |
br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !0 |
| 73 |
|
| 74 |
for.end: |
| 75 |
ret i32 %add |
| 76 |
} |
| 77 |
|
| 78 |
!0 = distinct !{!0, !1} |
| 79 |
!1 = !{!"llvm.loop.unroll.disable", i1 true} |