This is a fix for https://bugs.llvm.org/show_bug.cgi?id=39807, where two inlineable calls are merged to a basic block with no debug locations.
We have to pick _a_ location to avoid later inlining failures, but there are none in the destination BB, and we possibly can't pick either of the locations to hand if they're reached conditionally.
Thus, whenever there are no destination BB locations, delegate to getMergedLocation: it'll produce an "unknown" location if all else fails.
This solution is slightly stronger than necessary, in that non-call instructions will get "unknown" locations when merged into an otherwise empty BB. IMHO this is a feature: such insns explicitly don't have a location, and get marked as such.
The test case is adapted from the PR and checks that a) we don't crash, and b) an unknown location is emitted.