+2019-04-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/90026
+ * cfgcleanup.c (try_optimize_cfg): When removing empty bb with no
+ successors, look for BARRIERs inside of the whole BB_FOOTER chain
+ rather than just at the start of it. If e->src BB_FOOTER is not NULL
+ in cfglayout mode, use emit_barrier_after_bb.
+
2018-04-11 Steve Ellcey <sellcey@marvell.com>
PR rtl-optimization/87763
if (current_ir_type () == IR_RTL_CFGLAYOUT)
{
- if (BB_FOOTER (b)
- && BARRIER_P (BB_FOOTER (b)))
+ rtx_insn *insn;
+ for (insn = BB_FOOTER (b);
+ insn; insn = NEXT_INSN (insn))
+ if (BARRIER_P (insn))
+ break;
+ if (insn)
FOR_EACH_EDGE (e, ei, b->preds)
- if ((e->flags & EDGE_FALLTHRU)
- && BB_FOOTER (e->src) == NULL)
+ if ((e->flags & EDGE_FALLTHRU))
{
- if (BB_FOOTER (b))
+ if (BB_FOOTER (b)
+ && BB_FOOTER (e->src) == NULL)
{
BB_FOOTER (e->src) = BB_FOOTER (b);
BB_FOOTER (b) = NULL;
}
else
- {
- start_sequence ();
- BB_FOOTER (e->src) = emit_barrier ();
- end_sequence ();
- }
+ emit_barrier_after_bb (e->src);
}
}
else
+2019-04-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/90026
+ * g++.dg/opt/pr90026.C: New test.
+
2018-04-11 Steve Ellcey <sellcey@marvell.com>
PR rtl-optimization/87763
--- /dev/null
+// PR rtl-optimization/90026
+// { dg-do compile }
+// { dg-options "-fnon-call-exceptions -ftracer -O2 -w" }
+
+typedef __SIZE_TYPE__ size_t;
+struct S { int *b; ~S () { delete b; } };
+void bar ();
+char c[sizeof (int)];
+
+void *
+operator new (size_t, void *)
+{
+ __builtin_unreachable ();
+}
+
+void
+foo ()
+{
+ S a;
+ if (a.b)
+ a.b = new int ();
+ bar ();
+ new (c) int ();
+}