re PR tree-optimization/84960 (ICE in GIMPLE pass: isolate-paths)

PR tree-optimization/84960
	* tree-cfg.c (remove_bb): Don't move forced labels into bb->prev_bb
	if it is ENTRY block, move them into single succ of ENTRY in that case.

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

From-SVN: r258744
This commit is contained in:
Jakub Jelinek 2018-03-21 21:53:16 +01:00 committed by Jakub Jelinek
parent 535808fd72
commit 3e129b5bc6
4 changed files with 34 additions and 0 deletions

View file

@ -1,3 +1,9 @@
2018-03-21 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/84960
* tree-cfg.c (remove_bb): Don't move forced labels into bb->prev_bb
if it is ENTRY block, move them into single succ of ENTRY in that case.
2018-03-21 Richard Sandiford <richard.sandiford@linaro.org>
PR tree-optimization/84811

View file

@ -1,3 +1,8 @@
2018-03-21 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/84960
* gcc.c-torture/compile/pr84960.c: New test.
2018-03-21 Richard Sandiford <richard.sandiford@linaro.org>
PR tree-optimization/84811

View file

@ -0,0 +1,17 @@
/* PR tree-optimization/84960 */
/* { dg-do compile { target indirect_jumps } } */
void
foo (unsigned int a, float b, void *c)
{
lab:
if ((b - (a %= 0) < 1U) * -1U)
;
else
{
unsigned int f = a;
__builtin_unreachable ();
c = &&lab;
}
goto *c;
}

View file

@ -2301,6 +2301,12 @@ remove_bb (basic_block bb)
}
new_bb = bb->prev_bb;
/* Don't move any labels into ENTRY block. */
if (new_bb == ENTRY_BLOCK_PTR_FOR_FN (cfun))
{
new_bb = single_succ (new_bb);
gcc_assert (new_bb != bb);
}
new_gsi = gsi_start_bb (new_bb);
gsi_remove (&i, false);
gsi_insert_before (&new_gsi, stmt, GSI_NEW_STMT);