1313#include " mlir/Transforms/LoopInvariantCodeMotionUtils.h"
1414
1515#include " mlir/IR/Operation.h"
16+ #include " mlir/IR/OperationSupport.h"
1617#include " mlir/IR/PatternMatch.h"
1718#include " mlir/Interfaces/LoopLikeInterface.h"
1819#include " mlir/Interfaces/SideEffectInterfaces.h"
1920#include " mlir/Interfaces/SubsetOpInterface.h"
2021#include " llvm/Support/Debug.h"
22+ #include " llvm/Support/DebugLog.h"
2123#include < queue>
2224
2325#define DEBUG_TYPE " licm"
@@ -64,8 +66,7 @@ size_t mlir::moveLoopInvariantCode(
6466 size_t numMoved = 0 ;
6567
6668 for (Region *region : regions) {
67- LLVM_DEBUG (llvm::dbgs () << " Original loop:\n "
68- << *region->getParentOp () << " \n " );
69+ LDBG () << " Original loop:\n " << *region->getParentOp ();
6970
7071 std::queue<Operation *> worklist;
7172 // Add top-level operations in the loop body to the worklist.
@@ -83,12 +84,13 @@ size_t mlir::moveLoopInvariantCode(
8384 if (op->getParentRegion () != region)
8485 continue ;
8586
86- LLVM_DEBUG (llvm::dbgs () << " Checking op: " << *op << " \n " );
87+ LDBG () << " Checking op: "
88+ << OpWithFlags (op, OpPrintingFlags ().skipRegions ());
8789 if (!shouldMoveOutOfRegion (op, region) ||
8890 !canBeHoisted (op, definedOutside))
8991 continue ;
9092
91- LLVM_DEBUG ( llvm::dbgs ( ) << " Moving loop-invariant op: " << *op << " \n " ) ;
93+ LDBG ( ) << " Moving loop-invariant op: " << *op;
9294 moveOutOfRegion (op, region);
9395 ++numMoved;
9496
0 commit comments