From: Richard Biener Date: Fri, 27 Jan 2017 12:24:54 +0000 (+0000) Subject: re PR tree-optimization/79244 (ice in replace_uses_by, at tree-cfg.c:1866) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=38f50ab65ae67aa9896ca7a18a80d77b4648a0b0;p=gcc.git re PR tree-optimization/79244 (ice in replace_uses_by, at tree-cfg.c:1866) 2017-01-27 Richard Biener 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2e52f20ecf7..41df9bbcc1b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-01-27 Richard Biener + + PR tree-optimization/79244 + * tree-vrp.c (remove_range_assertions): Forcefully propagate + out SSA names even if abnormal. + 2017-01-27 Jakub Jelinek * realmpfr.h: Poison MPFR_RND{N,Z,U,D}. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4f3104ba4ad..525a7c7f214 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-01-27 Richard Biener + + PR tree-optimization/79244 + * gcc.dg/torture/pr79244.c: New testcase. + 2017-01-27 Jakub Jelinek * g++.dg/cilk-plus/CK/fib-opr-overload.cc (main): Change diff --git a/gcc/testsuite/gcc.dg/torture/pr79244.c b/gcc/testsuite/gcc.dg/torture/pr79244.c new file mode 100644 index 00000000000..05143cd3b5e --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr79244.c @@ -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; +} diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index d7d7a0d3a08..e023244577c 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -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);