re PR tree-optimization/79244 (ice in replace_uses_by, at tree-cfg.c:1866)

2017-01-27  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/79244
	* tree-vrp.c (remove_range_assertions): Forcefully propagate
	out SSA names even if abnormal.

	* gcc.dg/torture/pr79244.c: New testcase.

From-SVN: r244973
This commit is contained in:
Richard Biener 2017-01-27 12:24:54 +00:00 committed by Richard Biener
parent c04f41398e
commit 38f50ab65a
4 changed files with 38 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2017-01-27 Richard Biener <rguenther@suse.de>
PR tree-optimization/79244
* tree-vrp.c (remove_range_assertions): Forcefully propagate
out SSA names even if abnormal.
2017-01-27 Jakub Jelinek <jakub@redhat.com>
* realmpfr.h: Poison MPFR_RND{N,Z,U,D}.

View file

@ -1,3 +1,8 @@
2017-01-27 Richard Biener <rguenther@suse.de>
PR tree-optimization/79244
* gcc.dg/torture/pr79244.c: New testcase.
2017-01-27 Jakub Jelinek <jakub@redhat.com>
* g++.dg/cilk-plus/CK/fib-opr-overload.cc (main): Change

View file

@ -0,0 +1,13 @@
/* { dg-do compile } */
long buf[5];
int bar (void);
int
foo (int x)
{
int y = __builtin_setjmp (buf);
while (x != 3 && x && x && x != 2)
x = bar ();
return y;
}

View file

@ -6974,8 +6974,20 @@ remove_range_assertions (void)
}
}
/* Propagate the RHS into every use of the LHS. */
replace_uses_by (lhs, var);
/* Propagate the RHS into every use of the LHS. For SSA names
also propagate abnormals as it merely restores the original
IL in this case (an replace_uses_by would assert). */
if (TREE_CODE (var) == SSA_NAME)
{
imm_use_iterator iter;
use_operand_p use_p;
gimple *use_stmt;
FOR_EACH_IMM_USE_STMT (use_stmt, iter, lhs)
FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
SET_USE (use_p, var);
}
else
replace_uses_by (lhs, var);
/* And finally, remove the copy, it is not needed. */
gsi_remove (&si, true);