From 49aecbebe25714a59fbd18e4852c411587db1994 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 28 Aug 2018 13:36:49 +0000 Subject: [PATCH] re PR tree-optimization/87124 (ICE have integer_cst in SSA_VAL, at tree-ssa-sccvn.c:462 while building 541.leela_r from SPEC2017) 2018-08-28 Richard Biener PR tree-optimization/87124 * tree-ssa-sccvn.c (vn_lookup_simplify_result): Guard against constants before looking up avail. * g++.dg/torture/pr87124.C: New testcase. From-SVN: r263918 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/torture/pr87124.C | 12 ++++++++++++ gcc/tree-ssa-sccvn.c | 2 +- 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/torture/pr87124.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 66396a0a4d3..20f8d0d50be 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-08-28 Richard Biener + + PR tree-optimization/87124 + * tree-ssa-sccvn.c (vn_lookup_simplify_result): Guard against + constants before looking up avail. + 2018-08-28 Jakub Jelinek PR middle-end/87099 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 64638c544f1..c00761123a6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-08-28 Richard Biener + + PR tree-optimization/87124 + * g++.dg/torture/pr87124.C: New testcase. + 2017-08-28 Paul Thomas PR fortran/80477 diff --git a/gcc/testsuite/g++.dg/torture/pr87124.C b/gcc/testsuite/g++.dg/torture/pr87124.C new file mode 100644 index 00000000000..3e7d480f19d --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr87124.C @@ -0,0 +1,12 @@ +// { dg-do compile } + +class A { + void m_fn1(); +}; + +void A::m_fn1() +{ + A *a = this; + for (int i; i && a;) + a = 0; +} diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 39ad0c595ac..2556b0c4527 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -5667,7 +5667,7 @@ vn_lookup_simplify_result (gimple_match_op *res_op) res_op->type, ops, &vnresult); /* If this is used from expression simplification make sure to return an available expression. */ - if (res && mprts_hook && rpo_avail) + if (res && TREE_CODE (res) == SSA_NAME && mprts_hook && rpo_avail) res = rpo_avail->eliminate_avail (vn_context_bb, res); return res; } -- 2.30.2