diff --git a/mlir/lib/Transforms/Utils/LoopUtils.cpp b/mlir/lib/Transforms/Utils/LoopUtils.cpp --- a/mlir/lib/Transforms/Utils/LoopUtils.cpp +++ b/mlir/lib/Transforms/Utils/LoopUtils.cpp @@ -220,7 +220,12 @@ /// their body into the containing Block. void mlir::promoteSingleIterationLoops(FuncOp f) { // Gathers all innermost loops through a post order pruned walk. - f.walk([](AffineForOp forOp) { promoteIfSingleIteration(forOp); }); + f.walk([](Operation *op) { + if (auto forOp = dyn_cast(op)) + promoteIfSingleIteration(forOp); + else if (auto forOp = dyn_cast(op)) + promoteIfSingleIteration(forOp); + }); } /// Generates an affine.for op with the specified lower and upper bounds