When strict = true, only pre-existing and newly-created ops are rewritten and/or folded. Such ops are stored in strictModeFilteredOps.
/// Applies the specified rewrite patterns on `ops` while also trying to fold /// these ops as well as any other ops that were in turn created due to such /// rewrites. [...] bool applyOpPatternsAndFold(...);
Newly-created ops were previously added to strictModeFilteredOps after calling addToWorklist (via GreedyPatternRewriteDriver::notifyOperationInserted). Therefore, newly-created ops were never added to the worklist.
Also fix a test case that should have gone into an infinite loop (test.replace_with_new_op was replaced with itself, which should have caused the op to be rewritten over and over), but did not due to this bug.
Related Revision: https://reviews.llvm.org/D127180