aboutsummaryrefslogtreecommitdiff
path: root/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mlir/lib/Transforms/LoopInvariantCodeMotion.cpp')
-rw-r--r--mlir/lib/Transforms/LoopInvariantCodeMotion.cpp22
1 files changed, 9 insertions, 13 deletions
diff --git a/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp b/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp
index a0f738b..35e0f48 100644
--- a/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp
+++ b/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp
@@ -10,34 +10,30 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Interfaces/LoopLikeInterface.h"
#include "mlir/Transforms/LoopInvariantCodeMotionUtils.h"
+#include "mlir/Transforms/Passes.h"
#include "mlir/Transforms/SideEffectUtils.h"
-namespace mlir {
-#define GEN_PASS_DEF_LOOPINVARIANTCODEMOTIONPASS
-#include "mlir/Transforms/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
namespace {
/// Loop invariant code motion (LICM) pass.
-struct LoopInvariantCodeMotionPass
- : public impl::LoopInvariantCodeMotionPassBase<
- LoopInvariantCodeMotionPass> {
- using LoopInvariantCodeMotionPassBase::LoopInvariantCodeMotionPassBase;
-
+struct LoopInvariantCodeMotion
+ : public LoopInvariantCodeMotionBase<LoopInvariantCodeMotion> {
void runOnOperation() override;
};
} // namespace
-void LoopInvariantCodeMotionPass::runOnOperation() {
+void LoopInvariantCodeMotion::runOnOperation() {
// Walk through all loops in a function in innermost-loop-first order. This
// way, we first LICM from the inner loop, and place the ops in
// the outer loop, which in turn can be further LICM'ed.
getOperation()->walk(
[&](LoopLikeOpInterface loopLike) { moveLoopInvariantCode(loopLike); });
}
+
+std::unique_ptr<Pass> mlir::createLoopInvariantCodeMotionPass() {
+ return std::make_unique<LoopInvariantCodeMotion>();
+}