https://github.com/Artem-B approved this pull request. LGTM overall. Do you have any specific examples demonstrating incorrect behavior we have now? It may be useful to add a test case for that. https://github.com/llvm/llvm-project/pull/109665