Commit 494e7532 by Tom de Vries Committed by Tom de Vries

[tail-merge] Fix side-effect test in stmt_local_def

2018-06-21  Tom de Vries  <tdevries@suse.de>

	PR tree-optimization/85859
	* tree-ssa-tail-merge.c (stmt_local_def): Copy gimple_is_call
	test with comment from bb_no_side_effects_p.

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

From-SVN: r261844
parent 8732dd82
2018-06-21 Tom de Vries <tdevries@suse.de>
PR tree-optimization/85859
* tree-ssa-tail-merge.c (stmt_local_def): Copy gimple_is_call
test with comment from bb_no_side_effects_p.
2018-06-21 Richard Biener <rguenther@suse.de> 2018-06-21 Richard Biener <rguenther@suse.de>
PR tree-optimization/86232 PR tree-optimization/86232
......
2018-06-21 Tom de Vries <tdevries@suse.de>
PR tree-optimization/85859
* gcc.dg/pr85859.c: New test.
2018-06-21 Richard Biener <rguenther@suse.de> 2018-06-21 Richard Biener <rguenther@suse.de>
PR tree-optimization/86232 PR tree-optimization/86232
......
/* { dg-do run } */
/* { dg-options "-ftree-tail-merge -Wno-div-by-zero -O2 -fno-dce -fno-isolate-erroneous-paths-dereference -fno-tree-dce -fno-tree-vrp" } */
int b, c, d, e;
__attribute__ ((noinline, noclone))
int foo (short f)
{
f %= 0;
return f;
}
int
main (void)
{
b = (unsigned char) __builtin_parity (d);
e ? foo (0) : (long) &c;
return 0;
}
...@@ -301,7 +301,15 @@ stmt_local_def (gimple *stmt) ...@@ -301,7 +301,15 @@ stmt_local_def (gimple *stmt)
if (gimple_vdef (stmt) != NULL_TREE if (gimple_vdef (stmt) != NULL_TREE
|| gimple_has_side_effects (stmt) || gimple_has_side_effects (stmt)
|| gimple_could_trap_p_1 (stmt, false, false) || gimple_could_trap_p_1 (stmt, false, false)
|| gimple_vuse (stmt) != NULL_TREE) || gimple_vuse (stmt) != NULL_TREE
/* Copied from tree-ssa-ifcombine.c:bb_no_side_effects_p():
const calls don't match any of the above, yet they could
still have some side-effects - they could contain
gimple_could_trap_p statements, like floating point
exceptions or integer division by zero. See PR70586.
FIXME: perhaps gimple_has_side_effects or gimple_could_trap_p
should handle this. */
|| is_gimple_call (stmt))
return false; return false;
def_p = SINGLE_SSA_DEF_OPERAND (stmt, SSA_OP_DEF); def_p = SINGLE_SSA_DEF_OPERAND (stmt, SSA_OP_DEF);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment