[gn build] Port 3986cffe8112
[llvm-project.git] / llvm / lib / Transforms / Vectorize / SandboxVectorizer / Passes / RegionsFromMetadata.cpp
blob8e3f5b77429c5a0d9212b0ae0b422c06ead6651d
1 //===- RegionsFromMetadata.cpp - A helper to test RegionPasses -----------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "llvm/Transforms/Vectorize/SandboxVectorizer/Passes/RegionsFromMetadata.h"
11 #include "llvm/SandboxIR/Region.h"
12 #include "llvm/Transforms/Vectorize/SandboxVectorizer/SandboxVectorizerPassBuilder.h"
14 namespace llvm::sandboxir {
16 RegionsFromMetadata::RegionsFromMetadata(StringRef Pipeline)
17 : FunctionPass("regions-from-metadata"),
18 RPM("rpm", Pipeline, SandboxVectorizerPassBuilder::createRegionPass) {}
20 bool RegionsFromMetadata::runOnFunction(Function &F, const Analyses &A) {
21 SmallVector<std::unique_ptr<sandboxir::Region>> Regions =
22 sandboxir::Region::createRegionsFromMD(F);
23 for (auto &R : Regions) {
24 RPM.runOnRegion(*R, A);
26 return false;
29 } // namespace llvm::sandboxir