diff --git a/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp b/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp --- a/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp +++ b/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp @@ -274,7 +274,7 @@ if (config.enableRegionSimplification) changed |= succeeded(simplifyRegions(*this, regions)); } while (changed && - (++iteration < config.maxIterations || + (iteration++ < config.maxIterations || config.maxIterations == GreedyRewriteConfig::kNoIterationLimit)); // Whether the rewrite converges, i.e. wasn't changed in the last iteration.