re PR tree-optimization/41643 (ICE (segmentation fault) for SPEC CPU2000's 176.gcc when using -fno-tree-dce)

PR tree-optimization/41643
	Backport from mainline
	2009-04-03  Richard Guenther  <rguenther@suse.de>

	* tree-tailcall.c (tree_optimize_tail_calls_1): Also split the
	edge from the entry block if we have degenerate PHI nodes in
	the first basic block.

	* gcc.dg/pr41643.c: New test.

From-SVN: r153996
This commit is contained in:
Jakub Jelinek 2009-11-07 18:39:48 +01:00 committed by Jakub Jelinek
parent c6bcb25b27
commit ea61a28777
4 changed files with 34 additions and 2 deletions

View File

@ -1,3 +1,13 @@
2009-11-07 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/41643
Backport from mainline
2009-04-03 Richard Guenther <rguenther@suse.de>
* tree-tailcall.c (tree_optimize_tail_calls_1): Also split the
edge from the entry block if we have degenerate PHI nodes in
the first basic block.
2009-11-05 Jakub Jelinek <jakub@redhat.com>
* c-common.c (fold_offsetof_1): Revert the recently added

View File

@ -1,3 +1,8 @@
2009-11-07 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/41643
* gcc.dg/pr41643.c: New test.
2009-11-06 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/41909

View File

@ -0,0 +1,15 @@
/* PR tree-optimization/41643 */
/* { dg-do compile } */
/* { dg-options "-O2 -fno-tree-dce" } */
struct S { int a; };
int
f (struct S *x)
{
int a = x->a;
if (a)
return f (x) + a;
else
return f (x);
}

View File

@ -920,8 +920,10 @@ tree_optimize_tail_calls_1 (bool opt_tailcalls)
if (!phis_constructed)
{
/* Ensure that there is only one predecessor of the block. */
if (!single_pred_p (first))
/* Ensure that there is only one predecessor of the block
or if there are existing degenerate PHI nodes. */
if (!single_pred_p (first)
|| !gimple_seq_empty_p (phi_nodes (first)))
first = split_edge (single_succ_edge (ENTRY_BLOCK_PTR));
/* Copy the args if needed. */