Skip to content

Commit 5da920b

Browse files
committed
[Passes] Improve opt-pipeline-vector-passes.ll test.
Add -NOT lines to ensure that no extra passes are run if -extra-vectorizer-passes is not specified. Also add a loop that actually gets vectorized in preparation for D115052.
1 parent 0a14674 commit 5da920b

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

llvm/test/Other/opt-pipeline-vector-passes.ll

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
; RUN: opt -disable-verify -debug-pass-manager -passes='default<O1>' -S %s 2>&1 | FileCheck %s --check-prefixes=O1
2-
; RUN: opt -disable-verify -debug-pass-manager -passes='default<O2>' -S %s 2>&1 | FileCheck %s --check-prefixes=O2
3-
; RUN: opt -disable-verify -debug-pass-manager -passes='default<O2>' -extra-vectorizer-passes -S %s 2>&1 | FileCheck %s --check-prefixes=O2_EXTRA
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
44

55
; REQUIRES: asserts
66

@@ -17,6 +17,8 @@
1717
; Everything runs at -O2.
1818
; O2-LABEL: Running pass: LoopVectorizePass
1919
; O2: Running pass: SLPVectorizerPass
20+
; O2-NOT: Running pass: EarlyCSEPass
21+
; O2-NOT: Running pass: LICMPass
2022
; O2: Running pass: VectorCombinePass
2123

2224
; Optionally run cleanup passes.
@@ -32,14 +34,20 @@
3234
; O2_EXTRA: Running pass: EarlyCSEPass
3335
; O2_EXTRA: Running pass: VectorCombinePass
3436

35-
define i64 @f(i1 %cond) {
37+
define i64 @f(i1 %cond, i32* %src, i32* %dst) {
3638
entry:
3739
br label %loop
3840

3941
loop:
4042
%i = phi i64 [ 0, %entry ], [ %inc, %loop ]
41-
%inc = add i64 %i, 1
42-
br i1 %cond, label %loop, label %exit
43+
%src.i = getelementptr i32, i32* %src, i64 %i
44+
%src.v = load i32, i32* %src.i
45+
%add = add i32 %src.v, 10
46+
%dst.i = getelementptr i32, i32* %dst, i64 %i
47+
store i32 %add, i32* %dst.i
48+
%inc = add nuw nsw i64 %i, 1
49+
%ec = icmp ne i64 %inc, 1000
50+
br i1 %ec, label %loop, label %exit
4351

4452
exit:
4553
ret i64 %i

0 commit comments

Comments
 (0)