Commit 6e456f4c by Jakub Jelinek Committed by Jakub Jelinek

re PR rtl-optimization/51495 (ICE: in force_nonfallthru_and_redirect, at…

re PR rtl-optimization/51495 (ICE: in force_nonfallthru_and_redirect, at cfgrtl.c:1171 with computed goto)

	PR rtl-optimization/51495
	* function.c (thread_prologue_and_epilogue_insns): Don't add
	to bb_tail basic blocks that have EDGE_COMPLEX predecessor edges
	from basic blocks not needing prologue.

	* gcc.c-torture/compile/pr51495.c: New test.

From-SVN: r182265
parent c88388e6
2011-12-12 Jakub Jelinek <jakub@redhat.com> 2011-12-12 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/51495
* function.c (thread_prologue_and_epilogue_insns): Don't add
to bb_tail basic blocks that have EDGE_COMPLEX predecessor edges
from basic blocks not needing prologue.
PR tree-optimization/51481 PR tree-optimization/51481
* gimple-fold.c (gimple_fold_call): Call * gimple-fold.c (gimple_fold_call): Call
maybe_clean_or_replace_eh_stmt. Avoid optimization if stmt has EH maybe_clean_or_replace_eh_stmt. Avoid optimization if stmt has EH
...@@ -5956,9 +5956,22 @@ thread_prologue_and_epilogue_insns (void) ...@@ -5956,9 +5956,22 @@ thread_prologue_and_epilogue_insns (void)
FOR_EACH_EDGE (e, ei, tmp_bb->preds) FOR_EACH_EDGE (e, ei, tmp_bb->preds)
if (single_succ_p (e->src) if (single_succ_p (e->src)
&& !bitmap_bit_p (&bb_on_list, e->src->index) && !bitmap_bit_p (&bb_on_list, e->src->index)
&& can_duplicate_block_p (e->src) && can_duplicate_block_p (e->src))
&& bitmap_set_bit (&bb_tail, e->src->index)) {
VEC_quick_push (basic_block, vec, e->src); edge pe;
edge_iterator pei;
/* If there is predecessor of e->src which doesn't
need prologue and the edge is complex,
we might not be able to redirect the branch
to a copy of e->src. */
FOR_EACH_EDGE (pe, pei, e->src->preds)
if ((pe->flags & EDGE_COMPLEX) != 0
&& !bitmap_bit_p (&bb_flags, pe->src->index))
break;
if (pe == NULL && bitmap_set_bit (&bb_tail, e->src->index))
VEC_quick_push (basic_block, vec, e->src);
}
} }
/* Now walk backwards from every block that is marked as needing /* Now walk backwards from every block that is marked as needing
......
2011-12-12 Jakub Jelinek <jakub@redhat.com> 2011-12-12 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/51495
* gcc.c-torture/compile/pr51495.c: New test.
PR tree-optimization/51481 PR tree-optimization/51481
* gcc.dg/pr51481.c: New test. * gcc.dg/pr51481.c: New test.
......
/* PR rtl-optimization/51495 */
void bar (void);
int
foo (int i)
{
static const void *const table[] = { &&begin, &&end };
goto *(table[i]);
begin:
bar ();
end:
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment