re PR tree-optimization/71661 (wrong code at -O3)

PR tree-optimization/71661
	* tree-cfgcleanup.c (remove_forwarder_block_with_phi): Handle case when
	removal of a forwarder exposes a new natural loop.

	PR tree-optimization/71661
	* gcc.dg/tree-ssa/pr71661.c: New test.

From-SVN: r240836
This commit is contained in:
Jeff Law 2016-10-06 10:23:22 -06:00 committed by Jeff Law
parent 63656b8da2
commit f31276858a
4 changed files with 47 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2016-10-05 Jeff Law <law@redhat.com>
PR tree-optimization/71661
* tree-cfgcleanup.c (remove_forwarder_block_with_phi): Handle case when
removal of a forwarder exposes a new natural loop.
2016-10-06 Uros Bizjak <ubizjak@gmail.com>
* config/i386/sse.md (andnot<mode>3): Add FALLTHRU comments.

View File

@ -1,3 +1,8 @@
2016-10-06 Jeff Law <law@redhat.com>
PR tree-optimization/71661
* gcc.dg/tree-ssa/pr71661.c: New test.
2016-10-06 Richard Biener <rguenther@suse.de>
PR tree-optimization/77855

View File

@ -0,0 +1,31 @@
/* { dg-do run } */
/* { dg-options "-O3 -fdisable-tree-ethread" } */
extern void exit (int);
int a, b;
void
fn1 ()
{
unsigned c = 0;
int d;
b = a;
if (a < 0)
goto L1;
for (; a < 1; a++)
d = 0;
for (; d < 2; d++)
{
for (c = 0; c < 3; c++)
L1:
a = 2;
}
}
int
main ()
{
fn1 ();
exit (0);
}

View File

@ -840,6 +840,11 @@ remove_forwarder_block_with_phi (basic_block bb)
if (dest == bb)
return false;
/* Removal of forwarders may expose new natural loops and thus
a block may turn into a loop header. */
if (current_loops && bb_loop_header_p (bb))
return false;
/* If the destination block consists of a nonlocal label, do not
merge it. */
label = first_stmt (dest);