[llvm] [SandboxVectorizer] Use sbvec-passes flag to create a pipeline of Region passes after BottomUpVec. (PR #111223)

Jorge Gorbe Moya via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 7 09:39:06 PDT 2024


================
@@ -17,10 +21,22 @@ class TargetTransformInfo;
 class SandboxVectorizerPass : public PassInfoMixin<SandboxVectorizerPass> {
   TargetTransformInfo *TTI = nullptr;
 
-public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  // Used to build a RegionPass pipeline to be run on Regions created by the
+  // bottom-up vectorization pass.
+  sandboxir::PassRegistry PR;
+
+  // The main vectorizer pass.
+  std::unique_ptr<sandboxir::BottomUpVec> BottomUpVecPass;
----------------
slackito wrote:

> making it a class member implies that it used across multiple member functions of SandboxVectorizerPass

Not the only reason possible to make something a member. Making it local to `runImpl` means constructing the `BottomUpVec` pass every time, which seems like a waste to me.

Also, conceptually I see the `SandboxVectorizer` pass as a wrapper around `BottomUpVec` that handles the creation of sandbox IR. I don't see anything wrong with the wrapper owning the thing it's wrapping.

https://github.com/llvm/llvm-project/pull/111223


More information about the llvm-commits mailing list