re PR tree-optimization/77839 (Memory- and compile time hog at -O1 and above)

2016-10-06  Richard Biener  <rguenther@suse.de>

	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
This commit is contained in:
Richard Biener 2016-10-06 08:54:37 +00:00 committed by Richard Biener
parent 2d5edbede6
commit 37f6a157f5
4 changed files with 57 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2016-10-06 Richard Biener <rguenther@suse.de>
PR tree-optimization/77839
* tree-ssa-sccvn.c (set_ssa_val_to): Forbid value -> constant value
lattice transition.
2016-10-06 Martin Liska <mliska@suse.cz>
* gcc.c: Set -fprofile-update=atomic when profiling is

View File

@ -1,3 +1,8 @@
2016-10-06 Richard Biener <rguenther@suse.de>
PR tree-optimization/77839
* gcc.dg/torture/pr77839.c: New testcase.
2016-10-06 Marek Polacek <polacek@redhat.com>
* g++.dg/cpp1z/init-statement9.C: New test.

View File

@ -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);
}
}
}

View File

@ -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;