This prevents the behavior observed in llvm.org/PR22369. I am not sure whether I am reading the code correctly, but the early exit based on isLiveOutPastPHIs() seems like a bug as it prevents the nice loop-splitting logic below.
This is still work in progress as it currently breaks a few tests. Mainly, it seems to influence which copies are local and which are non-local, which influences the order in which the RegisterCoalescer visits copies. Coalescing the wrong registers first has unwanted side-effects.