[llvm] 5da920b - [Passes] Improve opt-pipeline-vector-passes.ll test.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 3 12:18:58 PST 2021


Author: Florian Hahn
Date: 2021-12-03T20:15:59Z
New Revision: 5da920bf3a0968afe3c2410793056b95b3fd9f33

URL: https://github.com/llvm/llvm-project/commit/5da920bf3a0968afe3c2410793056b95b3fd9f33
DIFF: https://github.com/llvm/llvm-project/commit/5da920bf3a0968afe3c2410793056b95b3fd9f33.diff

LOG: [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.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/test/Other/opt-pipeline-vector-passes.ll b/llvm/test/Other/opt-pipeline-vector-passes.ll
index af702995d5758..fc3a6586d9196 100644
--- a/llvm/test/Other/opt-pipeline-vector-passes.ll
+++ b/llvm/test/Other/opt-pipeline-vector-passes.ll
@@ -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


        


More information about the llvm-commits mailing list