Skip to content

Commit eeb4c48

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. (cherry-picked from 31413c4 and 5da920b) The test has also been updated to check for the new-pm only.
1 parent 9becd18 commit eeb4c48

File tree

1 file changed

+14
-43
lines changed

1 file changed

+14
-43
lines changed

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

Lines changed: 14 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
; RUN: opt -enable-new-pm=0 -O1 -debug-pass=Structure < %s -o /dev/null 2>&1 | FileCheck %s --check-prefixes=OLDPM_O1
2-
; RUN: opt -enable-new-pm=0 -O2 -debug-pass=Structure < %s -o /dev/null 2>&1 | FileCheck %s --check-prefixes=OLDPM_O2
3-
; RUN: opt -enable-new-pm=0 -O2 -extra-vectorizer-passes -debug-pass=Structure < %s -o /dev/null 2>&1 | FileCheck %s --check-prefixes=OLDPM_O2_EXTRA
4-
; RUN: opt -enable-new-pm=0 -O1 -vectorize-loops=0 -debug-pass=Structure < %s -o /dev/null 2>&1 | FileCheck %s --check-prefixes=OLDPM_O1_FORCE_OFF
5-
; RUN: opt -enable-new-pm=0 -O2 -vectorize-loops=0 -debug-pass=Structure < %s -o /dev/null 2>&1 | FileCheck %s --check-prefixes=OLDPM_O2_FORCE_OFF
61
; RUN: opt -disable-verify -debug-pass-manager -passes='default<O1>' -S %s 2>&1 | FileCheck %s --check-prefixes=NEWPM_O1
72
; RUN: opt -disable-verify -debug-pass-manager -passes='default<O2>' -S %s 2>&1 | FileCheck %s --check-prefixes=NEWPM_O2
83
; RUN: opt -disable-verify -debug-pass-manager -passes='default<O2>' -extra-vectorizer-passes -S %s 2>&1 | FileCheck %s --check-prefixes=NEWPM_O2_EXTRA
@@ -18,41 +13,11 @@
1813
; OLDPM_O1: Optimize scalar/vector ops
1914

2015
; Everything runs at -O2.
21-
22-
; OLDPM_O2-LABEL: Pass Arguments:
23-
; OLDPM_O2: Loop Vectorization
24-
; OLDPM_O2: SLP Vectorizer
25-
; OLDPM_O2: Optimize scalar/vector ops
26-
27-
; Optionally run cleanup passes.
28-
29-
; OLDPM_O2_EXTRA-LABEL: Pass Arguments:
30-
; OLDPM_O2_EXTRA: Loop Vectorization
31-
; OLDPM_O2_EXTRA: Early CSE
32-
; OLDPM_O2_EXTRA: Value Propagation
33-
; OLDPM_O2_EXTRA: Combine redundant instructions
34-
; OLDPM_O2_EXTRA: Loop Invariant Code Motion
35-
; OLDPM_O2_EXTRA: Unswitch loops
36-
; OLDPM_O2_EXTRA: Simplify the CFG
37-
; OLDPM_O2_EXTRA: Combine redundant instructions
38-
; OLDPM_O2_EXTRA: SLP Vectorizer
39-
; OLDPM_O2_EXTRA: Early CSE
40-
; OLDPM_O2_EXTRA: Optimize scalar/vector ops
41-
42-
43-
; The loop vectorizer still runs at both -O1/-O2 even with the
44-
; debug flag, but it only works on loops explicitly annotated
45-
; with pragmas.
46-
47-
; OLDPM_O1_FORCE_OFF-LABEL: Pass Arguments:
48-
; OLDPM_O1_FORCE_OFF: Loop Vectorization
49-
; OLDPM_O1_FORCE_OFF-NOT: SLP Vectorizer
50-
; OLDPM_O1_FORCE_OFF: Optimize scalar/vector ops
51-
52-
; OLDPM_O2_FORCE_OFF-LABEL: Pass Arguments:
53-
; OLDPM_O2_FORCE_OFF: Loop Vectorization
54-
; OLDPM_O2_FORCE_OFF: SLP Vectorizer
55-
; OLDPM_O2_FORCE_OFF: Optimize scalar/vector ops
16+
; O2-LABEL: Running pass: LoopVectorizePass
17+
; O2-NOT: Running pass: EarlyCSEPass
18+
; O2-NOT: Running pass: LICMPass
19+
; O2: Running pass: SLPVectorizerPass
20+
; O2: Running pass: VectorCombinePass
5621

5722
; There should be no difference with the new pass manager.
5823
; This is tested more thoroughly in other test files.
@@ -77,14 +42,20 @@
7742
; NEWPM_O2_EXTRA: Running pass: EarlyCSEPass
7843
; NEWPM_O2_EXTRA: Running pass: VectorCombinePass
7944

80-
define i64 @f(i1 %cond) {
45+
define i64 @f(i1 %cond, i32* %src, i32* %dst) {
8146
entry:
8247
br label %loop
8348

8449
loop:
8550
%i = phi i64 [ 0, %entry ], [ %inc, %loop ]
86-
%inc = add i64 %i, 1
87-
br i1 %cond, label %loop, label %exit
51+
%src.i = getelementptr i32, i32* %src, i64 %i
52+
%src.v = load i32, i32* %src.i
53+
%add = add i32 %src.v, 10
54+
%dst.i = getelementptr i32, i32* %dst, i64 %i
55+
store i32 %add, i32* %dst.i
56+
%inc = add nuw nsw i64 %i, 1
57+
%ec = icmp ne i64 %inc, 1000
58+
br i1 %ec, label %loop, label %exit
8859

8960
exit:
9061
ret i64 %i

0 commit comments

Comments
 (0)