https://github.com/jeanPerier requested changes to this pull request. The overlap checking is still unsafe/not generic enough, otherwise this looks like the good direction to me. https://github.com/llvm/llvm-project/pull/197814