From: Jakub Jelinek Date: Fri, 12 Apr 2019 07:27:25 +0000 (+0200) Subject: re PR rtl-optimization/90026 (ICE: verify_flow_info failed (error: missing barrier... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c758576accc3eef33c31766352453b0ad1953569;p=gcc.git re PR rtl-optimization/90026 (ICE: verify_flow_info failed (error: missing barrier after block 2)) 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. * g++.dg/opt/pr90026.C: New test. From-SVN: r270304 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 970bdf8a4f5..a5dda2bedec 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2019-04-12 Jakub Jelinek + + 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 PR rtl-optimization/87763 diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index 86b26275033..992912ce195 100644 --- a/gcc/cfgcleanup.c +++ b/gcc/cfgcleanup.c @@ -2712,23 +2712,23 @@ try_optimize_cfg (int mode) 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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 840df424cb2..d66bc36415c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-04-12 Jakub Jelinek + + PR rtl-optimization/90026 + * g++.dg/opt/pr90026.C: New test. + 2018-04-11 Steve Ellcey PR rtl-optimization/87763 diff --git a/gcc/testsuite/g++.dg/opt/pr90026.C b/gcc/testsuite/g++.dg/opt/pr90026.C new file mode 100644 index 00000000000..3971ef09367 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr90026.C @@ -0,0 +1,24 @@ +// 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 (); +}