From: Richard Biener Date: Fri, 31 Aug 2018 16:50:13 +0000 (+0000) Subject: re PR tree-optimization/87168 (ICE on valid code at -Os and above on x86_64-linux... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d5481391bc0d71df048476dfb471afb86e9621d9;p=gcc.git re PR tree-optimization/87168 (ICE on valid code at -Os and above on x86_64-linux-gnu: verify_ssa failed) 2018-08-31 Richard Biener PR tree-optimization/87168 * tree-ssa-sccvn.c (SSA_VAL): Add visited output parameter. (rpo_elim::eliminate_avail): When OP was not visited it must be available. * gcc.dg/torture/pr87168.c: New testcase. From-SVN: r264021 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e48b983fcd5..79aa7ce34f6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2018-08-31 Richard Biener + + PR tree-optimization/87168 + * tree-ssa-sccvn.c (SSA_VAL): Add visited output parameter. + (rpo_elim::eliminate_avail): When OP was not visited it must + be available. + 2018-08-31 David Malcolm * tree-vrp.c (copy_value_range): Convert param "from" from diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c10f1d299c5..757dd1bb288 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-08-31 Richard Biener + + PR tree-optimization/87168 + * gcc.dg/torture/pr87168.c: New testcase. + 2018-08-31 Vlad Lazar * gcc.target/aarch64/scalar_intrinsics.c (test_vnegd_s64): New. diff --git a/gcc/testsuite/gcc.dg/torture/pr87168.c b/gcc/testsuite/gcc.dg/torture/pr87168.c new file mode 100644 index 00000000000..d66ed98dca0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr87168.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ + +int a, b, c, d, e, f, *g; + +int main () +{ + unsigned i; + while (b) + { + int j, m; +L1: + f = j; +L2: + if (i && e) + { + i = f; + goto L2; + } + j = f; + if (a) + goto L3; + for (m = 0; m < 2; m++) + if (d) + goto L1; + goto L2; +L3: + (&j != g) | c; + } + return 0; +} diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 2bf71e5b15b..c333b89b204 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -456,9 +456,11 @@ VN_INFO (tree name) /* Return the SSA value of X. */ inline tree -SSA_VAL (tree x) +SSA_VAL (tree x, bool *visited = NULL) { vn_ssa_aux_t tem = vn_ssa_aux_hash->find_with_hash (x, SSA_NAME_VERSION (x)); + if (visited) + *visited = tem && tem->visited; return tem && tem->visited ? tem->valnum : x; } @@ -5681,7 +5683,12 @@ rpo_elim::~rpo_elim () tree rpo_elim::eliminate_avail (basic_block bb, tree op) { - tree valnum = SSA_VAL (op); + bool visited; + tree valnum = SSA_VAL (op, &visited); + /* If we didn't visit OP then it must be defined outside of the + region we process and also dominate it. So it is available. */ + if (!visited) + return op; if (TREE_CODE (valnum) == SSA_NAME) { if (SSA_NAME_IS_DEFAULT_DEF (valnum))