https://github.com/ftynse requested changes to this pull request. Thanks, looks reasonable in general. Requesting changes for mixed low-level and rewriter API usage that is known to cause issues. https://github.com/llvm/llvm-project/pull/94391