re PR rtl-optimization/32773 (SH: ICE in create_pre_exit, at mode-switching.c:223)

PR rtl-optimization/32773
	* cfglayout.c (force_one_exit_fallthru): New function.
	(cfg_layout_finalize): Use it.

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

From-SVN: r126700
This commit is contained in:
Zdenek Dvorak 2007-07-17 05:56:40 +02:00 committed by Zdenek Dvorak
parent 02634bb287
commit 9f2e9ac43b
4 changed files with 73 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2007-07-17 Zdenek Dvorak <dvorakz@suse.cz>
PR rtl-optimization/32773
* cfglayout.c (force_one_exit_fallthru): New function.
(cfg_layout_finalize): Use it.
2007-07-16 Richard Guenther <rguenther@suse.de>
Uros Bizjak <ubizjak@gmail.com>

View File

@ -963,6 +963,56 @@ fixup_fallthru_exit_predecessor (void)
bb->aux = NULL;
}
}
/* In case there are more than one fallthru predecessors of exit, force that
there is only one. */
static void
force_one_exit_fallthru (void)
{
edge e, predecessor = NULL;
bool more = false;
edge_iterator ei;
basic_block forwarder, bb;
FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR->preds)
if (e->flags & EDGE_FALLTHRU)
{
if (predecessor == NULL)
predecessor = e;
else
{
more = true;
break;
}
}
if (!more)
return;
/* Exit has several fallthru predecessors. Create a forwarder block for
them. */
forwarder = split_edge (predecessor);
for (ei = ei_start (EXIT_BLOCK_PTR->preds); (e = ei_safe_edge (ei)); )
{
if (e->src == forwarder
|| !(e->flags & EDGE_FALLTHRU))
ei_next (&ei);
else
redirect_edge_and_branch_force (e, forwarder);
}
/* Fix up the chain of blocks -- make FORWARDER immediately preceed the
exit block. */
FOR_EACH_BB (bb)
{
if (bb->aux == NULL && bb != forwarder)
{
bb->aux = forwarder;
break;
}
}
}
/* Return true in case it is possible to duplicate the basic block BB. */
@ -1178,6 +1228,7 @@ cfg_layout_finalize (void)
#ifdef ENABLE_CHECKING
verify_flow_info ();
#endif
force_one_exit_fallthru ();
rtl_register_cfg_hooks ();
if (reload_completed
#ifdef HAVE_epilogue

View File

@ -1,3 +1,8 @@
2007-07-17 Zdenek Dvorak <dvorakz@suse.cz>
PR rtl-optimization/32773
* gcc.dg/pr32773.c: New test.
2007-07-16 Andrew Pinski <andrew_pinski@playstation.sony.com>
* gcc.target/spu/intrinsics-1.c: Use dg-message to

View File

@ -0,0 +1,11 @@
/* { dg-do compile } */
/* { dg-options "-O -fprofile-use" } */
/* { dg-options "-O -m4 -fprofile-use" { target sh-*-* } } */
void foo (int *p)
{
if (p)
*p = 0;
} /* { dg-message "note: \[^\n\]*execution counts estimated" } */
/* { dg-final { cleanup-coverage-files } } */