This transformation is a variation on the GuardWidening transformation we have checked in as it's own pass. Instead of focusing on merge (i.e. hoisting and simplifying) two widenable branches, this transform makes the observation that simply removing a second slowpath block (by reusing an existing one) is often a very useful canonicalization. This may lead to later merging, or may not. This is a useful generalization when the intermediate block has loads whose dereferenceability is hard to establish.
As noted in the patch, this can be generalized further. I'd like to get this in, and then iterate on top if that's okay with reviewers.
This can be structured better. First, you need NoSideEffects(*BI->getParent()) for both of the cases, so it can be turned into an early return check. And second, these cases seem to differ only by successor index. Factor out a lambda and call it for 0 and 1?