aboutsummaryrefslogtreecommitdiff
path: root/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp
diff options
context:
space:
mode:
authorRahul Joshi <jurahul@google.com>2020-06-23 17:23:35 -0700
committerRahul Joshi <jurahul@google.com>2020-06-23 17:27:43 -0700
commite7f7137cd7119b93bf2a0fa2049dbc38068ee20c (patch)
tree9e045b202a8352a9363b9efa6c7bf902abcb09f3 /mlir/lib/Transforms/LoopInvariantCodeMotion.cpp
parentbf8b63ed296c1ecad03c83b798ffbfa039cbceb4 (diff)
downloadllvm-e7f7137cd7119b93bf2a0fa2049dbc38068ee20c.zip
llvm-e7f7137cd7119b93bf2a0fa2049dbc38068ee20c.tar.gz
llvm-e7f7137cd7119b93bf2a0fa2049dbc38068ee20c.tar.bz2
[MLIR] [NFC] Add new line and empty line before printing modified loop
to make the debug output readable. Differential Revision: https://reviews.llvm.org/D82417
Diffstat (limited to 'mlir/lib/Transforms/LoopInvariantCodeMotion.cpp')
-rw-r--r--mlir/lib/Transforms/LoopInvariantCodeMotion.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp b/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp
index 9386653..95cdb78 100644
--- a/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp
+++ b/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp
@@ -32,15 +32,13 @@ struct LoopInvariantCodeMotion
: public LoopInvariantCodeMotionBase<LoopInvariantCodeMotion> {
void runOnOperation() override;
};
-} // end anonymous namespace
// Checks whether the given op can be hoisted by checking that
// - the op and any of its contained operations do not depend on SSA values
// defined inside of the loop (by means of calling definedOutside).
// - the op has no side-effects. If sideEffecting is Never, sideeffects of this
// op and its nested ops are ignored.
-static bool canBeHoisted(Operation *op,
- function_ref<bool(Value)> definedOutside) {
+bool canBeHoisted(Operation *op, function_ref<bool(Value)> definedOutside) {
// Check that dependencies are defined outside of loop.
if (!llvm::all_of(op->getOperands(), definedOutside))
return false;
@@ -74,6 +72,8 @@ static bool canBeHoisted(Operation *op,
return true;
}
+} // end anonymous namespace
+
LogicalResult mlir::moveLoopInvariantCode(LoopLikeOpInterface looplike) {
auto &loopBody = looplike.getLoopBody();
@@ -104,7 +104,7 @@ LogicalResult mlir::moveLoopInvariantCode(LoopLikeOpInterface looplike) {
// For all instructions that we found to be invariant, move outside of the
// loop.
auto result = looplike.moveOutOfLoop(opsToMove);
- LLVM_DEBUG(looplike.print(llvm::dbgs() << "Modified loop\n"));
+ LLVM_DEBUG(looplike.print(llvm::dbgs() << "\n\nModified loop:\n"));
return result;
}
@@ -113,7 +113,7 @@ void LoopInvariantCodeMotion::runOnOperation() {
// 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"));
+ LLVM_DEBUG(loopLike.print(llvm::dbgs() << "\nOriginal loop:\n"));
if (failed(moveLoopInvariantCode(loopLike)))
signalPassFailure();
});