Unlike ret/resume, for unreachable currently no such tail-merging
is being performed by clang. There has been at least one previous attempt
at this - D29428.
As for the motivation for this, the goal basically is to de-pessimize(*)
the source code that either uses exceptions, and/or is built with assertions,
and/or with ASAN/UBSan instrumentation in warnings-as-errors more.
In all of these cases there's a few function-terminating IR patterns,
but they are repeated over and over again, bloating the function size,
which naturally counts towards inlining cost, which naturally lowers
the chances of the functions compiled under such conditions from being inlined.
(* the insufficient inlining is the pessimization)
As discussed in D101231, while we could technically teach inliner to exempt
such function-terminating blocks from the cost calculation,
we don't really want to do that, because we'd end with even more cold code.
But instead we can achieve much the same goal by decreasing the inline cost
via tail-merging & sinking common code.
All that being said, this is expected to result in *bigger* codesizes,
both because the inliner actually did something now,
and because ultimately the tail duplication in backend might have
undone what we have done here..