+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.
+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
--- /dev/null
+/* { 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 *-*-* } } } */
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;