aboutsummaryrefslogtreecommitdiff
path: root/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp
diff options
context:
space:
mode:
authorMogball <jeffniu22@gmail.com>2022-04-16 00:36:22 +0000
committerMogball <jeffniu22@gmail.com>2022-04-16 00:37:07 +0000
commitfa26c7ff4b5d94763106712bf0009f2abde343c0 (patch)
tree823f6c40fa3a6bc777b4f39649bbf4107e707895 /mlir/lib/Transforms/LoopInvariantCodeMotion.cpp
parent984a0dc386553f28068716a087d65ccf8a92889b (diff)
downloadllvm-fa26c7ff4b5d94763106712bf0009f2abde343c0.zip
llvm-fa26c7ff4b5d94763106712bf0009f2abde343c0.tar.gz
llvm-fa26c7ff4b5d94763106712bf0009f2abde343c0.tar.bz2
[mlir] Refactor LICM into a utility
LICM is refactored into a utility that is application on any region. The implementation is moved to Transform/Utils.
Diffstat (limited to 'mlir/lib/Transforms/LoopInvariantCodeMotion.cpp')
-rw-r--r--mlir/lib/Transforms/LoopInvariantCodeMotion.cpp15
1 files changed, 4 insertions, 11 deletions
diff --git a/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp b/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp
index 14761a8..35e0f48 100644
--- a/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp
+++ b/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp
@@ -11,15 +11,10 @@
//===----------------------------------------------------------------------===//
#include "PassDetail.h"
-#include "mlir/IR/Builders.h"
#include "mlir/Interfaces/LoopLikeInterface.h"
-#include "mlir/Interfaces/SideEffectInterfaces.h"
+#include "mlir/Transforms/LoopInvariantCodeMotionUtils.h"
#include "mlir/Transforms/Passes.h"
-#include "llvm/ADT/SmallPtrSet.h"
-#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/Debug.h"
-
-#define DEBUG_TYPE "licm"
+#include "mlir/Transforms/SideEffectUtils.h"
using namespace mlir;
@@ -35,10 +30,8 @@ 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) {
- LLVM_DEBUG(loopLike.print(llvm::dbgs() << "\nOriginal loop:\n"));
- moveLoopInvariantCode(loopLike);
- });
+ getOperation()->walk(
+ [&](LoopLikeOpInterface loopLike) { moveLoopInvariantCode(loopLike); });
}
std::unique_ptr<Pass> mlir::createLoopInvariantCodeMotionPass() {