https://github.com/banach-space requested changes to this pull request. Please could you address my comments before landing this? It feels that there's scope for better code re-use. https://github.com/llvm/llvm-project/pull/89067