From: Richard Biener Date: Wed, 29 Aug 2018 06:47:14 +0000 (+0000) Subject: re PR tree-optimization/87126 (ICE on valid code at -Os and above on x86_64-linux... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e37f7da9c4b77aac0690c190206b286b9c82becd;p=gcc.git 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 PR tree-optimization/87126 * tree-ssa-sccvn.c (vn_reference_insert): Remove assert. * gcc.dg/tree-ssa/pr87126.c: New testcase. From-SVN: r263944 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c41507662dd..03a98c90ab2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2018-08-29 Richard Biener + + PR tree-optimization/87126 + * tree-ssa-sccvn.c (vn_reference_insert): Remove assert. + 2018-08-28 Jim Wilson * config/riscv/pic.md: Rewrite. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 72f5a95984e..e6a9c8610cd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-08-29 Richard Biener + + PR tree-optimization/87126 + * gcc.dg/tree-ssa/pr87126.c: New testcase. + 2018-08-28 MCC CS PR tree-optimization/87009 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr87126.c b/gcc/testsuite/gcc.dg/tree-ssa/pr87126.c new file mode 100644 index 00000000000..37232ba3a0a --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr87126.c @@ -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 *-*-* } } } */ diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 2556b0c4527..aaac430bb46 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -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;