19 #include "llvm/Support/Debug.h"
23 #define GEN_PASS_DEF_LOOPCOALESCING
24 #include "mlir/Dialect/Affine/Passes.h.inc"
28 #define PASS_NAME "loop-coalescing"
29 #define DEBUG_TYPE PASS_NAME
35 struct LoopCoalescingPass
36 :
public affine::impl::LoopCoalescingBase<LoopCoalescingPass> {
38 void runOnOperation()
override {
39 func::FuncOp func = getOperation();
41 if (
auto scfForOp = dyn_cast<scf::ForOp>(op))
43 else if (
auto affineForOp = dyn_cast<AffineForOp>(op))
51 std::unique_ptr<OperationPass<func::FuncOp>>
53 return std::make_unique<LoopCoalescingPass>();
Operation is the basic unit of execution within MLIR.
std::unique_ptr< OperationPass< func::FuncOp > > createLoopCoalescingPass()
Creates a pass that transforms perfectly nested loops with independent bounds into a single loop.
LogicalResult coalescePerfectlyNestedAffineLoops(AffineForOp op)
Walk an affine.for to find a band to coalesce.
Include the generated interface declarations.
LogicalResult coalescePerfectlyNestedSCFForLoops(scf::ForOp op)
Walk an affine.for to find a band to coalesce.