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 @@ -1160,8 +1160,10 @@ function_ref annotateFn) { assert(unrollFactor > 0 && "unroll factor should be positive"); - if (unrollFactor == 1) - return promoteIfSingleIteration(forOp); + if (unrollFactor == 1) { + (void)promoteIfSingleIteration(forOp); + return success(); + } // Nothing in the loop body other than the terminator. if (llvm::hasSingleElement(forOp.getBody()->getOperations())) @@ -1215,8 +1217,10 @@ scf::ForOp forOp, uint64_t unrollFactor, function_ref annotateFn) { assert(unrollFactor > 0 && "expected positive unroll factor"); - if (unrollFactor == 1) - return promoteIfSingleIteration(forOp); + if (unrollFactor == 1) { + (void)promoteIfSingleIteration(forOp); + return success(); + } // Return if the loop body is empty. if (llvm::hasSingleElement(forOp.getBody()->getOperations())) @@ -1383,8 +1387,10 @@ uint64_t unrollJamFactor) { assert(unrollJamFactor > 0 && "unroll jam factor should be positive"); - if (unrollJamFactor == 1) - return promoteIfSingleIteration(forOp); + if (unrollJamFactor == 1) { + (void)promoteIfSingleIteration(forOp); + return success(); + } // Nothing in the loop body other than the terminator. if (llvm::hasSingleElement(forOp.getBody()->getOperations()))