The greedy pattern rewriter consists of two nested loops. config.maxIterations (which configurable on the CanonicalizerPass) controls the maximum number of iterations of the outer loops.
/// This specifies the maximum number of times the rewriter will iterate /// between applying patterns and simplifying regions. Use `kNoLimit` to /// disable this iteration limit. int64_t maxIterations = 10;
This change adds config.maxNumRewrites which controls the maximum number of pattern rewrites within an iteration. (It effectively control the maximum number of iterations of the inner loop.)
This flag is meant for debugging and useful in cases where one or multiple faulty patterns can be applied indefinitely, resulting in an infinite loop. Such bugs are difficult to debug even with mlir-opt -debug because no output will printed to the terminal until the process terminates.