llvm.memcpy/memset/memmove return void but they will return the first argument after they are expanded as libcalls. Now if the parent function has any return value, llvm.memcpy cannot be turned into tail call after expansion.
The patch is to handle that case in SelectionDAGBuilder so when caller function return the same value as the first argument of llvm.memcpy, tail call is allowed.
This is only true if the argument is specifically expanded to a libcall to the C library function "memcpy". If the target expands it to some other library call (e.g., __aeabi_memcpy, like we do on Android), it isn't a tail call, and we miscompile.