xref: /llvm-project/llvm/test/Other/opt-pipeline-vector-passes.ll (revision 38386b4318e3ba54f450480ad49b237a9c357af4)
1; RUN: opt -disable-verify -debug-pass-manager -passes='default<O1>' -force-vector-width=4 -S %s 2>&1 | FileCheck %s --check-prefixes=O1
2; RUN: opt -disable-verify -debug-pass-manager -passes='default<O2>' -force-vector-width=4 -S %s 2>&1 | FileCheck %s --check-prefixes=O2
3; RUN: opt -disable-verify -debug-pass-manager -passes='default<O2>' -force-vector-width=4 -extra-vectorizer-passes -S %s 2>&1 | FileCheck %s --check-prefixes=O2_EXTRA
4
5; When the loop doesn't get vectorized, no extra vector passes should run.
6; RUN: opt -disable-verify -debug-pass-manager -passes='default<O2>' -force-vector-width=0 -extra-vectorizer-passes -S %s 2>&1 | FileCheck %s --check-prefixes=O2
7
8; REQUIRES: asserts
9
10; The loop vectorizer still runs at both -O1/-O2 even with the
11; debug flag, but it only works on loops explicitly annotated
12; with pragmas.
13
14; SLP does not run at -O1. Loop vectorization runs, but it only
15; works on loops explicitly annotated with pragmas.
16; O1-LABEL:  Running pass: LoopVectorizePass
17; O1-NOT:    Running pass: SLPVectorizerPass
18; O1:        Running pass: VectorCombinePass
19
20; Everything runs at -O2.
21; O2-LABEL:  Running pass: LoopVectorizePass
22; O2-NOT:    Running pass: EarlyCSEPass
23; O2-NOT:    Running pass: LICMPass
24; O2:        Running pass: SLPVectorizerPass
25; O2:        Running pass: VectorCombinePass
26
27; Optionally run cleanup passes.
28; O2_EXTRA-LABEL: Running pass: LoopVectorizePass
29; O2_EXTRA: Running pass: EarlyCSEPass
30; O2_EXTRA: Running pass: CorrelatedValuePropagationPass
31; O2_EXTRA: Running pass: InstCombinePass
32; O2_EXTRA: Running pass: LICMPass
33; O2_EXTRA: Running pass: SimpleLoopUnswitchPass
34; O2_EXTRA: Running pass: SimplifyCFGPass
35; O2_EXTRA: Running pass: InstCombinePass
36; O2_EXTRA: Running pass: SLPVectorizerPass
37; O2_EXTRA: Running pass: EarlyCSEPass
38; O2_EXTRA: Running pass: VectorCombinePass
39
40define i64 @f(i1 %cond, ptr %src, ptr %dst) {
41entry:
42  br label %loop
43
44loop:
45  %i = phi i64 [ 0, %entry ], [ %inc, %loop ]
46  %src.i = getelementptr i32, ptr %src, i64 %i
47  %src.v = load i32, ptr %src.i
48  %add = add i32 %src.v, 10
49  %dst.i = getelementptr i32, ptr %dst, i64 %i
50  store i32 %add, ptr %dst.i
51  %inc = add nuw nsw i64 %i, 1
52  %ec = icmp ne i64 %inc, 1000
53  br i1 %ec, label %loop, label %exit
54
55exit:
56  ret i64 %i
57}
58