https://github.com/kuhar requested changes to this pull request. I find it hard to follow the `matchAndRewrite` code -- could we brake it down a bit and introduce some helper functions? https://github.com/llvm/llvm-project/pull/78510