https://github.com/david-arm approved this pull request. LGTM! I had a minor comment about potentially adding an assert that `ExitingBB` is non-null - I'll leave that to you if you think it's worth it or not. https://github.com/llvm/llvm-project/pull/115066