re PR tree-optimization/61383 (wrong code at -O2 and -O3 on x86_64-linux-gnu)

2014-06-03  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/61383
	* tree-ssa-ifcombine.c (bb_no_side_effects_p): Make sure
	stmts can't trap.

	* gcc.dg/torture/pr61383-1.c: New testcase.

From-SVN: r211163
This commit is contained in:
Richard Biener 2014-06-03 08:48:28 +00:00 committed by Richard Biener
parent b48e9677e5
commit 597c6315ca
4 changed files with 50 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2014-06-03 Richard Biener <rguenther@suse.de>
PR tree-optimization/61383
* tree-ssa-ifcombine.c (bb_no_side_effects_p): Make sure
stmts can't trap.
2014-06-03 Richard Sandiford <rdsandiford@googlemail.com>
* defaults.h (USE_MD_CONSTRAINTS, EXTRA_MEMORY_CONSTRAINT)

View File

@ -1,3 +1,8 @@
2014-06-03 Richard Biener <rguenther@suse.de>
PR tree-optimization/61383
* gcc.dg/torture/pr61383-1.c: New testcase.
2014-06-03 Andreas Schwab <schwab@linux-m68k.org>
* gcc.target/powerpc/vsxcopy.c (dg-options): Add -mvsx.

View File

@ -0,0 +1,35 @@
/* { dg-do run } */
int a, b = 1, c, d, e, f, g;
int
fn1 ()
{
int h;
for (;;)
{
g = b;
g = g ? 0 : 1 % g;
e = a + 1;
for (; d < 1; d = e)
{
if (f == 0)
h = 0;
else
h = 1 % f;
if (f < 1)
c = 0;
else if (h)
break;
}
if (b)
return 0;
}
}
int
main ()
{
fn1 ();
return 0;
}

View File

@ -127,7 +127,11 @@ bb_no_side_effects_p (basic_block bb)
{
gimple stmt = gsi_stmt (gsi);
if (is_gimple_debug (stmt))
continue;
if (gimple_has_side_effects (stmt)
|| gimple_could_trap_p (stmt)
|| gimple_vuse (stmt))
return false;
}