From 339e6723c9c2c062933c17eec128407a0778d99d Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 3 Sep 2018 14:29:00 +0000 Subject: [PATCH] re PR tree-optimization/87200 (ICE in set_ssa_val_to, at tree-ssa-sccvn.c:3629) 2018-09-03 Richard Biener PR tree-optimization/87200 * tree-ssa-sccvn.c (vn_nary_build_or_lookup_1): Valueize a simplify result. * gcc.dg/torture/pr87200.c: New testcase. From-SVN: r264062 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/torture/pr87200.c | 23 +++++++++++++++++++++++ gcc/tree-ssa-sccvn.c | 9 +++++++-- 4 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr87200.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 40795e7ad39..981e7063f97 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-09-03 Richard Biener + + PR tree-optimization/87200 + * tree-ssa-sccvn.c (vn_nary_build_or_lookup_1): Valueize a + simplify result. + 2018-09-03 Martin Liska PR tree-optimization/87201 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bd06f66b3d6..b44c714d7d2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-09-03 Richard Biener + + PR tree-optimization/87200 + * gcc.dg/torture/pr87200.c: New testcase. + 2018-09-03 Richard Biener PR tree-optimization/87197 diff --git a/gcc/testsuite/gcc.dg/torture/pr87200.c b/gcc/testsuite/gcc.dg/torture/pr87200.c new file mode 100644 index 00000000000..a0356315f26 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr87200.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ + +unsigned long long int ry; + +int +gl (void) +{ + long long int my = 0; + unsigned long long int *oi = (unsigned long long int *) &my; + int s9; + + s9 = !!gl () ? ry : 0; + if (s9 != 0) + oi = &ry; + else + { + my = ry; + *oi += my; + } + + return *oi; +} + diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 26d093ea05b..1f003358851 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -1759,8 +1759,13 @@ vn_nary_build_or_lookup_1 (gimple_match_op *res_op, bool insert) gimple *new_stmt = NULL; if (res && gimple_simplified_result_is_gimple_val (res_op)) - /* The expression is already available. */ - result = res_op->ops[0]; + { + /* The expression is already available. */ + result = res_op->ops[0]; + /* Valueize it, simplification returns sth in AVAIL only. */ + if (TREE_CODE (result) == SSA_NAME) + result = SSA_VAL (result); + } else { tree val = vn_lookup_simplify_result (res_op); -- 2.30.2