aboutsummaryrefslogtreecommitdiff
path: root/mlir/lib/Transforms/ControlFlowSink.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mlir/lib/Transforms/ControlFlowSink.cpp')
-rw-r--r--mlir/lib/Transforms/ControlFlowSink.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/mlir/lib/Transforms/ControlFlowSink.cpp b/mlir/lib/Transforms/ControlFlowSink.cpp
index 960a035..5b0cfc2 100644
--- a/mlir/lib/Transforms/ControlFlowSink.cpp
+++ b/mlir/lib/Transforms/ControlFlowSink.cpp
@@ -13,32 +13,24 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/IR/Dominance.h"
#include "mlir/Interfaces/ControlFlowInterfaces.h"
#include "mlir/Interfaces/SideEffectInterfaces.h"
#include "mlir/Transforms/ControlFlowSinkUtils.h"
+#include "mlir/Transforms/Passes.h"
#include "mlir/Transforms/SideEffectUtils.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONTROLFLOWSINKPASS
-#include "mlir/Transforms/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
namespace {
/// A control-flow sink pass.
-struct ControlFlowSinkPass
- : public impl::ControlFlowSinkPassBase<ControlFlowSinkPass> {
- using ControlFlowSinkPassBase::ControlFlowSinkPassBase;
-
+struct ControlFlowSink : public ControlFlowSinkBase<ControlFlowSink> {
void runOnOperation() override;
};
} // end anonymous namespace
-void ControlFlowSinkPass::runOnOperation() {
+void ControlFlowSink::runOnOperation() {
auto &domInfo = getAnalysis<DominanceInfo>();
getOperation()->walk([&](RegionBranchOpInterface branch) {
SmallVector<Region *> regionsToSink;
@@ -56,3 +48,7 @@ void ControlFlowSinkPass::runOnOperation() {
});
});
}
+
+std::unique_ptr<Pass> mlir::createControlFlowSinkPass() {
+ return std::make_unique<ControlFlowSink>();
+}