diff --git a/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp b/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp index 8043f604f9b4..0b80cd66459b 100644 --- a/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp +++ b/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp @@ -274,7 +274,7 @@ bool GreedyPatternRewriteDriver::simplify(MutableArrayRef regions) { 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.