Skip to content

Commit 2e11538

Browse files
[mlir] Use isPure and skipRegions to print region op (NFC) (#163422)
1 parent 04d2b5d commit 2e11538

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

mlir/lib/Transforms/Utils/LoopInvariantCodeMotionUtils.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ size_t mlir::moveLoopInvariantCode(
6666
size_t numMoved = 0;
6767

6868
for (Region *region : regions) {
69-
LDBG() << "Original loop:\n" << *region->getParentOp();
69+
LDBG() << "Original loop:\n"
70+
<< OpWithFlags(region->getParentOp(),
71+
OpPrintingFlags().skipRegions());
7072

7173
std::queue<Operation *> worklist;
7274
// Add top-level operations in the loop body to the worklist.
@@ -90,7 +92,8 @@ size_t mlir::moveLoopInvariantCode(
9092
!canBeHoisted(op, definedOutside))
9193
continue;
9294

93-
LDBG() << "Moving loop-invariant op: " << *op;
95+
LDBG() << "Moving loop-invariant op: "
96+
<< OpWithFlags(op, OpPrintingFlags().skipRegions());
9497
moveOutOfRegion(op, region);
9598
++numMoved;
9699

@@ -111,9 +114,7 @@ size_t mlir::moveLoopInvariantCode(LoopLikeOpInterface loopLike) {
111114
[&](Value value, Region *) {
112115
return loopLike.isDefinedOutsideOfLoop(value);
113116
},
114-
[&](Operation *op, Region *) {
115-
return isMemoryEffectFree(op) && isSpeculatable(op);
116-
},
117+
[&](Operation *op, Region *) { return isPure(op); },
117118
[&](Operation *op, Region *) { loopLike.moveOutOfLoop(op); });
118119
}
119120

0 commit comments

Comments
 (0)