re PR tree-optimization/87126 (ICE on valid code at -Os and above on x86_64-linux-gnu: in vn_reference_insert, at tree-ssa-sccvn.c:2698)

2018-08-29  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/87126
	* tree-ssa-sccvn.c (vn_reference_insert): Remove assert.

	* gcc.dg/tree-ssa/pr87126.c: New testcase.

From-SVN: r263944
This commit is contained in:
Richard Biener 2018-08-29 06:47:14 +00:00 committed by Richard Biener
parent efc601240c
commit e37f7da9c4
4 changed files with 46 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2018-08-29 Richard Biener <rguenther@suse.de>
PR tree-optimization/87126
* tree-ssa-sccvn.c (vn_reference_insert): Remove assert.
2018-08-28 Jim Wilson <jimw@sifive.com>
* config/riscv/pic.md: Rewrite.

View File

@ -1,3 +1,8 @@
2018-08-29 Richard Biener <rguenther@suse.de>
PR tree-optimization/87126
* gcc.dg/tree-ssa/pr87126.c: New testcase.
2018-08-28 MCC CS <deswurstes@users.noreply.github.com>
PR tree-optimization/87009

View File

@ -0,0 +1,25 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-fre1" } */
int a, *b;
void f ()
{
int d = 0, e = d;
while (a++)
;
if (e)
goto L2;
L1:
d = e;
b = &d;
L2:
if (d)
goto L1;
}
/* The load of d could be eliminated if we'd value-number the
irreducible region in RPO of the reducible result. Likewise
a redundant store could be removed. */
/* { dg-final { scan-tree-dump-times "d = 0;" 1 "fre1" { xfail *-*-* } } } */
/* { dg-final { scan-tree-dump-not " = d;" "fre1" { xfail *-*-* } } } */

View File

@ -2696,7 +2696,17 @@ vn_reference_insert (tree op, tree result, tree vuse, tree vdef)
but save a lookup if we deal with already inserted refs here. */
if (*slot)
{
gcc_assert (operand_equal_p ((*slot)->result, vr1->result, 0));
/* We cannot assert that we have the same value either because
when disentangling an irreducible region we may end up visiting
a use before the corresponding def. That's a missed optimization
only though. See gcc.dg/tree-ssa/pr87126.c for example. */
if (dump_file && (dump_flags & TDF_DETAILS)
&& !operand_equal_p ((*slot)->result, vr1->result, 0))
{
fprintf (dump_file, "Keeping old value ");
print_generic_expr (dump_file, (*slot)->result);
fprintf (dump_file, " because of collision\n");
}
free_reference (vr1);
obstack_free (&vn_tables_obstack, vr1);
return;