From 37f6a157f592dcd13f61f693b40257621ac83226 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 6 Oct 2016 08:54:37 +0000 Subject: [PATCH] re PR tree-optimization/77839 (Memory- and compile time hog at -O1 and above) 2016-10-06 Richard Biener PR tree-optimization/77839 * tree-ssa-sccvn.c (set_ssa_val_to): Forbid value -> constant value lattice transition. * gcc.dg/torture/pr77839.c: New testcase. From-SVN: r240829 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/torture/pr77839.c | 29 ++++++++++++++++++++++++++ gcc/tree-ssa-sccvn.c | 17 +++++++++++++++ 4 files changed, 57 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr77839.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index aa41f37050c..b7e7a6d0f59 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-10-06 Richard Biener + + PR tree-optimization/77839 + * tree-ssa-sccvn.c (set_ssa_val_to): Forbid value -> constant value + lattice transition. + 2016-10-06 Martin Liska * gcc.c: Set -fprofile-update=atomic when profiling is diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1f55a336708..0f24a758cf2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-10-06 Richard Biener + + PR tree-optimization/77839 + * gcc.dg/torture/pr77839.c: New testcase. + 2016-10-06 Marek Polacek * g++.dg/cpp1z/init-statement9.C: New test. diff --git a/gcc/testsuite/gcc.dg/torture/pr77839.c b/gcc/testsuite/gcc.dg/torture/pr77839.c new file mode 100644 index 00000000000..b98231b56ff --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr77839.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ + +void +sd(int yn) +{ + while (yn < 1) + { + int hy; + int *n6 = &hy; + int **ot = &n6; + + (void)ot; + for (yn = 0; yn < 1; ++yn) + { + int tc, wo = 0, ez = 0, b8 = 0; + int *ls = &wo; + + (void)ls; + hy = 0; + for (tc = 0; tc < 1; ++tc) + { + ez ^= hy; + wo ^= ez; + ++b8; + } + hy += (b8 < wo); + } + } +} diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 1653d7393dc..fc8bf74766b 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -3260,6 +3260,23 @@ set_ssa_val_to (tree from, tree to) } return false; } + else if (currval != VN_TOP + && ! is_gimple_min_invariant (currval) + && is_gimple_min_invariant (to)) + { + if (dump_file && (dump_flags & TDF_DETAILS)) + { + fprintf (dump_file, "Forcing VARYING instead of changing " + "value number of "); + print_generic_expr (dump_file, from, 0); + fprintf (dump_file, " from "); + print_generic_expr (dump_file, currval, 0); + fprintf (dump_file, " (non-constant) to "); + print_generic_expr (dump_file, to, 0); + fprintf (dump_file, " (constant)\n"); + } + to = from; + } else if (TREE_CODE (to) == SSA_NAME && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (to)) to = from; -- 2.30.2