http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60418
--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> --- Do we need to verify that basic block DEST has a single predecessor? This patch works for me: diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c index 926d300..0ed15df 100644 --- a/gcc/tree-cfgcleanup.c +++ b/gcc/tree-cfgcleanup.c @@ -316,6 +316,8 @@ tree_forwarder_block_p (basic_block bb, bool phi_wanted) /* Protect loop preheaders and latches if requested. */ if (dest->loop_father->header == dest) { + if (single_pred_p (dest)) + { if (bb->loop_father == dest->loop_father) { if (loops_state_satisfies_p (LOOPS_HAVE_SIMPLE_LATCHES)) @@ -329,6 +331,7 @@ tree_forwarder_block_p (basic_block bb, bool phi_wanted) } else if (bb->loop_father == loop_outer (dest->loop_father)) return !loops_state_satisfies_p (LOOPS_HAVE_PREHEADERS); + } /* Always preserve other edges into loop headers that are not simple latches or preheaders. */ return false;