https://github.com/philnik777 requested changes to this pull request. I haven't looked at the tests yet. The implementation itself looks mostly good. https://github.com/llvm/llvm-project/pull/68494