The main purpose of merge return is to rewrite functions so that inlining is able to inline the function correctly. In #2018, we had to add another restriction: do not inline if there is a return in a loop, even if it is the only return.
This is because you cannot branch from that location directly to where it needs to go. We should get merge-return to work around this issue.
The example can be found here: https://github.com/KhronosGroup/SPIRV-Tools/files/2529819/spirvopt-bug.zip.