
My previous attempt (#111904) hacked creation of Regions from metadata into the bottom-up vectorizer. I got some feedback that it should be its own pass. So now we have two SandboxIR function passes (`BottomUpVec` and `RegionsFromMetadata`) that are interchangeable, and we could have other SandboxIR function passes doing other kinds of transforms, so this commit revamps pipeline creation and parsing. First, `sandboxir::PassManager::setPassPipeline` now accepts pass arguments in angle brackets. Pass arguments are arbitrary strings that must be parsed by each pass, the only requirement is that nested angle bracket pairs must be balanced, to allow for nested pipelines with more arguments. For example: ``` bottom-up-vec<region-pass-1,region-pass-2<arg>,region-pass-3> ``` This has complicated the parser a little bit (the loop over pipeline characters now contains a small state machine), and we now have some new test cases to exercise the new features. The main SandboxVectorizerPass now contains a customizable pipeline of SandboxIR function passes, defined by the `sbvec-passes` flag. Region passes for the bottom-up vectorizer pass are now in pass arguments (like in the example above). Because we have now several classes that can build sub-pass pipelines, I've moved the logic that interacts with PassRegistry.def into its own files (PassBuilder.{h,cpp} so it can be easily reused. Finally, I've added a `RegionsFromMetadata` function pass, which will allow us to run region passes in isolation from lit tests without relying on the bottom-up vectorizer, and a new lit test that does exactly this. Note that the new pipeline parser now allows empty pipelines. This is useful for testing. For example, if we use ``` -sbvec-passes="bottom-up-vec<>" ``` SandboxVectorizer converts LLVM IR to SandboxIR and runs the bottom-up vectorizer, but no region passes afterwards. ``` -sbvec-passes="" ``` SandboxVectorizer converts LLVM IR to SandboxIR and runs no passes on it. This is useful to exercise SandboxIR conversion on its own.
29 lines
900 B
LLVM
29 lines
900 B
LLVM
; RUN: opt -passes=sandbox-vectorizer -sbvec-print-pass-pipeline \
|
|
; RUN: -disable-output -sbvec-passes="bottom-up-vec<null,null>" %s \
|
|
; RUN: | FileCheck %s
|
|
;
|
|
; RUN: opt -passes=sandbox-vectorizer -sbvec-print-pass-pipeline \
|
|
; RUN: -disable-output -sbvec-passes="bottom-up-vec<>,regions-from-metadata<>" %s \
|
|
; RUN: | FileCheck --check-prefix CHECK-MULTIPLE-FUNCTION-PASSES %s
|
|
|
|
; !!!WARNING!!! This won't get updated by update_test_checks.py !
|
|
|
|
; This checks the user defined pass pipeline.
|
|
define void @pipeline() {
|
|
ret void
|
|
}
|
|
|
|
; CHECK: fpm
|
|
; CHECK: bottom-up-vec
|
|
; CHECK: rpm
|
|
; CHECK: null
|
|
; CHECK: null
|
|
; CHECK-EMPTY:
|
|
|
|
; CHECK-MULTIPLE-FUNCTION-PASSES: fpm
|
|
; CHECK-MULTIPLE-FUNCTION-PASSES: bottom-up-vec
|
|
; CHECK-MULTIPLE-FUNCTION-PASSES: rpm
|
|
; CHECK-MULTIPLE-FUNCTION-PASSES: regions-from-metadata
|
|
; CHECK-MULTIPLE-FUNCTION-PASSES: rpm
|
|
; CHECK-MULTIPLE-FUNCTION-PASSES-EMPTY:
|