https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71028
--- Comment #2 from Segher Boessenkool <segher at gcc dot gnu.org> --- Author: segher Date: Tue May 10 23:31:27 2016 New Revision: 236106 URL: https://gcc.gnu.org/viewcvs?rev=236106&root=gcc&view=rev Log: cfgcleanup: Handle a branch with just a return in both arms (PR71028) If we have a conditional jump that has only a return in both the branch path and the fallthrough path, and the return on the branch path can not be made a conditional return, we will try to make a conditional return from the fallthrough path, and that does not work because we then try to redirect the (new) jump in the fallthrough block to the original dest in the branch path, which is the exit block. For the testcase on ARM we end up in this situation because before the jump2 pass there are some other insns in the return blocks as well, but the same insns in both, so those are moved above the conditional jump. Only later (in the ce3 pass) are the conditional jump and two returns melded into one return, so we need to handle this strange case here. PR rtl-optimization/71028 * cfgcleanup.c (try_optimize_cfg): Do not flip a conditional jump with just a return in the fallthrough block if the branch block contains just a returns as well. Modified: trunk/gcc/ChangeLog trunk/gcc/cfgcleanup.c