[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.
This commit is contained in:
Florian Hahn 2021-12-03 20:15:59 +00:00
parent 0a14674f27
commit 5da920bf3a
No known key found for this signature in database
GPG Key ID: EEF712BB5E80EBBA
1 changed files with 14 additions and 6 deletions

View File

@ -1,6 +1,6 @@
; RUN: opt -disable-verify -debug-pass-manager -passes='default<O1>' -S %s 2>&1 | FileCheck %s --check-prefixes=O1
; RUN: opt -disable-verify -debug-pass-manager -passes='default<O2>' -S %s 2>&1 | FileCheck %s --check-prefixes=O2
; RUN: opt -disable-verify -debug-pass-manager -passes='default<O2>' -extra-vectorizer-passes -S %s 2>&1 | FileCheck %s --check-prefixes=O2_EXTRA
; RUN: opt -disable-verify -debug-pass-manager -passes='default<O1>' -force-vector-width=4 -S %s 2>&1 | FileCheck %s --check-prefixes=O1
; RUN: opt -disable-verify -debug-pass-manager -passes='default<O2>' -force-vector-width=4 -S %s 2>&1 | FileCheck %s --check-prefixes=O2
; 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
; REQUIRES: asserts
@ -17,6 +17,8 @@
; Everything runs at -O2.
; O2-LABEL: Running pass: LoopVectorizePass
; O2: Running pass: SLPVectorizerPass
; O2-NOT: Running pass: EarlyCSEPass
; O2-NOT: Running pass: LICMPass
; O2: Running pass: VectorCombinePass
; Optionally run cleanup passes.
@ -32,14 +34,20 @@
; O2_EXTRA: Running pass: EarlyCSEPass
; O2_EXTRA: Running pass: VectorCombinePass
define i64 @f(i1 %cond) {
define i64 @f(i1 %cond, i32* %src, i32* %dst) {
entry:
br label %loop
loop:
%i = phi i64 [ 0, %entry ], [ %inc, %loop ]
%inc = add i64 %i, 1
br i1 %cond, label %loop, label %exit
%src.i = getelementptr i32, i32* %src, i64 %i
%src.v = load i32, i32* %src.i
%add = add i32 %src.v, 10
%dst.i = getelementptr i32, i32* %dst, i64 %i
store i32 %add, i32* %dst.i
%inc = add nuw nsw i64 %i, 1
%ec = icmp ne i64 %inc, 1000
br i1 %ec, label %loop, label %exit
exit:
ret i64 %i